Depends if you need a closure.  There are times I do 2D mappings, and
I have to write something like

(map (partail map #(do-work %)) coll).

Or I have to compose my mapping operations.

for is awesome when you need some of the other built-ins, like :while

Sean

On Dec 17, 12:39 pm, Erik Price <erikpr...@gmail.com> wrote:
> On Thu, Dec 17, 2009 at 12:16 PM, Konrad Hinsen
>
> <konrad.hin...@fastmail.net> wrote:
>
> > On 17 Dec 2009, at 15:44, Sean Devlin wrote:
> > > (defn map-vals [f coll]
> > >  (into {} (map (juxt key (comp f val)) coll))
>
> vs:
>
> > (defmethod fmap clojure.lang.IPersistentMap
> >   [f m]
> >   (into (empty m) (for [[k v] m] [k (f v)])))
>
> Are there any guidelines as to when it's appropriate to use the map
> function vs a list comprehension?
>
> e

-- 
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

Reply via email to