Created
May 28, 2010 20:38
-
-
Save PaulHobbs/417710 to your computer and use it in GitHub Desktop.
This file contains 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
(defn vrange2 [n] | |
(loop [i 0 v (transient [])] | |
(if (< i n) | |
(recur (inc i) (conj! v i)) | |
(persistent! v)))) | |
;; Slower!? | |
(defn vrange3 [n] | |
(loop [ i (int 0) v (transient [])] | |
(if (< i n) | |
(recur (inc i) (conj! v i)) | |
(persistent! v)))) | |
(time (def v2 (vrange2 1000000))) | |
(time (def v3 (vrange3 1000000))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment