Skip to content

Instantly share code, notes, and snippets.

@kpmaynard
Created January 17, 2014 19:22
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 kpmaynard/8479693 to your computer and use it in GitHub Desktop.
Save kpmaynard/8479693 to your computer and use it in GitHub Desktop.
;; Unlike JavaScript loop locals are not mutable! In JavaScript you would see ;; a list of ten 9's. In ClojureScript we see the expected numbers from 0 to 9.
(let [fns (loop [i 0 ret []]
(if (< i 10)
(recur (inc i) (conj ret (fn [] i)))
ret))]
(map #(%) fns))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment