> Just tried, my first foray into reducers, but I must not be understanding > something correctly: > > (time (r/map burn (doall (range 4)))) > > returns in less than a second on my macbook pro, whereas > > (time (doall (map burn (range 4)))) > > takes nearly a minute. > > This feels like unforced laziness (although it's not quite that fast), but > clojure.core.reducers/map involves no laziness, right? > > Yep, reducers, don't use lazy seqs. But they return just sth. like transformed functions, that will be applied when building the collection. So you can use them like this:
(into [] (r/map burn (doall (range 4))))) See http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html and http://clojure.com/blog/2012/05/15/anatomy-of-reducer.html for more info... Marek. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en