Created
January 17, 2014 19:22
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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