Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Last active August 29, 2015 14:24
(ns accumulate)
(defn accumulate [func coll]
(let [accumulate-rec
(fn [acc [first-elem & rest-elems]]
(if (nil? first-elem)
acc
(recur (conj acc (func first-elem))
rest-elems)))]
(accumulate-rec [] coll)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment