On Fri, Jan 8, 2010 at 11:34 AM, Sean Devlin <francoisdev...@gmail.com> wrote: > Take a look at pmap
I don't think that's the kind of "parallel" being asked about. > On Jan 8, 11:13 am, Conrad <drc...@gmail.com> wrote: >> Looping variables in a clojure "for" loop are iterated in a serial, >> cartesian fashion: >> >> > (for [a (range 5) b (range 10 15)] >> >> (+ a b)) >> (10 11 12 13 14 11 12 13 14 15 12 13 14 15 16 13 14 15 16 17 14 15 16 >> 17 18) >> >> I was wondering if there's a standard idiom for looping in parallel >> fashion- Doesn't look like it's supported by the "for" macro directly. >> The best code I can come up with to do this is: >> >> > (for [[a b] (map vector (range 5) (range 10 15))] >> >> (+ a b)) >> (10 12 14 16 18) >> >> Is there a more elegant way to do this? Probably not. 'map' is the primary way to walk multiple seqs in step. 'zipmap' does this too, though only for building a hash-map. Of course you can always use recur as well. --Chouser -- -- I funded Clojure 2010, did you?
-- 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