Skip to content

Instantly share code, notes, and snippets.

@denlab
Created January 23, 2013 09:37
Show Gist options
  • Save denlab/4603675 to your computer and use it in GitHub Desktop.
Save denlab/4603675 to your computer and use it in GitHub Desktop.
cs2013.enonce3> (defn f [x] (* 2 x))
#'cs2013.enonce3/f
cs2013.enonce3> (defn g [x] (* 3 x))
#'cs2013.enonce3/g
cs2013.enonce3> (defn h [x] (* 4 x))
#'cs2013.enonce3/h
cs2013.enonce3> (defn i [x] (* 5 x))
#'cs2013.enonce3/i
cs2013.enonce3> (defn j [x] (* 6 x))
#'cs2013.enonce3/j
cs2013.enonce3> (defn k [x] (* 7 x))
#'cs2013.enonce3/k
cs2013.enonce3> (time (->> (range 10000000)
(map (comp f g h i j k))
(reduce +)))
"Elapsed time: 4142.392982 msecs"
251999974800000000
cs2013.enonce3> (time (->> (range 10000000)
(map f)
(map g)
(map h)
(map i)
(map j)
(map k)
(reduce +)))
"Elapsed time: 3366.231696 msecs"
251999974800000000
cs2013.enonce3>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment