Erik,

My experience is that you should only use filter/map if you either have a
pre-existing function or you want to use a _very_ short closure (using #()).
For any other case the code becomes unmanageable and then I feel that using
for is the wiser choice.

I hope that they are just as efficient, but I haven't really tested it. I
feel like even if it isn't right now they can be brought up to the same
speed.

--
http://wave.theWE.net
http://twitter.com/theWE_



On Thu, Dec 17, 2009 at 7: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<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

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