On Feb 14, 4:32 pm, cej38 <junkerme...@gmail.com> wrote: > Laziness is great when there are things that may not ever be needed. > But it slows things down when you know that you are going to need some > function applied to every element of some col. The doall function is > your friend in this case.
AFAIK, most if not all of the lazy constructs in clojure have a penalty attached that is only applied the first time you realize the sequence. Executing a doall on a lazy seq does not reduce the penalty (and probably makes the overall running time slightly longer). But there might be exceptions to that, that I don't know about. For speedy and clever algorithms, not using lazy constructs at all and modifying stuff in-place is probably the way to go, though I would certainly advice against doing that before there is a working "clean" solution that's been tested to show where the actual slow stuff resides. Profiling is generally much better than intuition. J. -- 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