Skip to content

Instantly share code, notes, and snippets.

@drakezhard
Created March 10, 2016 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drakezhard/16c0ec687e3b5c73b86b to your computer and use it in GitHub Desktop.
Save drakezhard/16c0ec687e3b5c73b86b to your computer and use it in GitHub Desktop.
clojure map naive implementation
(defn my-map [f coll]
(loop [acc []
c coll]
(if (empty? coll)
acc
(let [frst (first c)
rst (rest c)
new-val (conj acc (f frst))]
(if (empty? rst)
new-val
(recur new-val rst))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment