On Mon, Nov 09, 2009 at 09:07:31AM -0800, pmf wrote: > >On Nov 9, 5:39 pm, David Brown <cloj...@davidb.org> wrote: >> >> (let-map [x [31 41 59 26] >> y (iterate inc 1)] >> (+ x y)) >> >> Probably not that interesting in the simple case. > >How is this different from using for? It's also lazy and supports >destructuring. > >(for [x [31 41 59 26] > y (iterate inc 1)] > (+ x y))
And gives very different results. 'for' iterates over it's sequences in a nested fasion. For your particular example, it will return the sequence from (+ 31 1) (+ 31 2) and so on, and never get to the second element of the first vector. 'let-map' walks through the sequences together, like 'map', hence the name. The given 'let-map' example returns a sequence of 4 elements. David --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---