4 ms·
A REPL is nice too: (reduce + (range 366))
by icey 17y ago
A REPL is nice too:
(reduce + (range 366))
- deleted 17y ago[deleted]
- Torn 17y agoPython: reduce (operator.add, range(366))
- tome 17y agoor sum(range(366))
- deleted 17y ago[deleted]
- Torn 17y agodidn't even think of that one! :)
- karanbhangui 17y agoor plain math: n(n+1)/2
- mahmud 17y agoHow quickly can you generalize the plain math formula to these sequences: http://www.research.att.com/njas/sequences/index.html http://www.research.att.com/njas/sequences/index.html
- deleted 17y ago[deleted]
- mahmud 17y ago(sum (range 1 365)) assuming you defined these already; I have them in my utils library ;-) (defun range (start end) (loop for x from start to end collecting x)) (defun sum (sequence) (reduce #'+ sequence))