> On Jun 2, 2014, at 7:14 PM, Gary Johnson <gwjoh...@uvm.edu> wrote: > >> Hey Lee, >> >> I would second Jozef's suggestion that you look into using the reducers >> library when you need non-lazy sequence operations. [etc]
On Jun 2, 2014, at 10:38 PM, Lee Spector <lspec...@hampshire.edu> wrote: > > Gary: That's compelling indeed, and I will look into it more! Some quick notes and a question from my first look into this: - I watched a Rich Hickey reducers video, was riveted, and see that they are beautiful. I particularly appreciated his brief aside about how lazy seqs have independent utility. - In practice, for the little program I posted about previously, switching to reducers involved a couple of initially unexpected complications, some of now make sense to me but others of which don't fully: results of reducers sometimes have to be explicitly converted, e.g. with "into []"; r/map doesn't take multiple collections; I don't immediately see elegant reducer-based approaches to uses of "for" or "repeat", etc. - My initial swapping of clojure.core.reducers functions for lazy seq (and agent-based parallel computing) functions seems to make my performance worse rather than better. I realize that there are several possible explanations for this and I have to look at my usage more carefully. It's definitely possible that I'm doing more than one thing wrong, but one question that this leads to is: - If I operate on a vector with a sequence of r/map and r/filter operations and finally with "into []" to get back a vector, then I think that fold will be called within the call to into, and that parallelism should happen there... right? But if that's right, how do I control the group size that the call to fold uses in this case? I see how to specify the group size for a direct call to fold, but not for other function in the library. Thanks, -Lee -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.