Re: Map vs For

2010-06-28 Thread ataggart
I prefer map for turning one sequence into another sequence of equal length. I generally only use for when I need a cartesian product of multiple sequences, or am going to leverage :let, :when, or :while in the binding. On Jun 28, 11:48 am, Oleg wrote: > I will show example based on hiccup libra

Re: Map vs For

2010-06-28 Thread Moritz Ulrich
I'd prefer the for-version in this case. You see the differences if you try `for` and `map` with multiple collections. `for` is a traditional list-comprehension (1). `map` iterates over many sequences at once, `for` does "nested" iteration. (1): http://en.wikipedia.org/wiki/List_comprehension#Clo

Map vs For

2010-06-28 Thread Oleg
I will show example based on hiccup library: For version: [:ol (for [x coll] [:li x])] Map version: [:ol (map (fn [x] [:li x]) coll)] What's the difference between them? What is better for performance? Cheers, Oleg -- You received this message because you are subscribed to the Google Groups "C