Personally, I think the cl loop-macro is kind of ugly. Yes, it's a nice dsl for looping, but it is almost too powerful for my taste. Too complicated to learn, if you can accomplish the same thing with sexps.
However, you can combine doseq, destructuring and the map-stuff by Meikel Brandmeyer to loop over two lists in parallel: (doseq [[a b] (map vector [:a :b :c :d :e] [1 2 3 4 5])] (println a "," b)) (You can also try to port the loop-macro from common lisp to clojure, that would be interesting) On Fri, Jun 18, 2010 at 7:45 PM, viksit <vik...@gmail.com> wrote: > Hey Meikel, > > On Jun 17, 10:48 pm, Meikel Brandmeyer <m...@kotka.de> wrote: >> Hi, >> >> On Jun 18, 1:35 am, viksit <vik...@gmail.com> wrote: >> >> > (loop for x in '(a b c d e) >> > for y in '(1 2 3 4 5) >> > collect (list x y) ) >> >> > ((A 1) (B 2) (C 3) (D 4) (E 5)) >> >> > Are there any good (and idiomatic) methods to achieve this using a >> > Clojure loop construct? >> >> user=> (map vector [:a :b :c :d :e] [1 2 3 4 5]) >> ([:a 1] [:b 2] [:c 3] [:d 4] [:e 5]) > > Oh yes, thanks. I know about using the map method - I was just > wondering if Clojure's loop supports (or has any plans to support) the > loop construct as in CL (http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/ > node235.html). And if not, then are there any ways to "loop" through 2 > lists in parallel. > > Cheers > Viksit > >> >> Sincerely >> Meikel > > -- > 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 -- Moritz Ulrich Programmer, Student, Almost normal Guy http://www.google.com/profiles/ulrich.moritz -- 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