Programming-Idioms

History of Idiom 54 > diff from v30 to v31

Edit summary for version 31 :
New Clojure implementation by user [escherize]

Version 30

2019-09-26, 14:18:17

Version 31

2019-09-26, 14:53:38

Idiom #54 Compute sum of integers

Calculate the sum s of integer list x.

Idiom #54 Compute sum of integers

Calculate the sum s of integer list x.

Code
(defn sum [xs] (reduce + xs))

(sum [1 20 300])
;;=> 123
Comments bubble
xs is a collection of integers.