Hi,

Newbie here with a simple question: what is the preferred way of
mapping a function to a seq? Use an anonymous function or use a
partial?

Consider this:

user=> (map (fn [n] (+ 2 n)) [1 2 3 4 5])
(3 4 5 6 7)
user=> (map (partial + 2) [1 2 3 4 5])
(3 4 5 6 7)
user=>

I know that the answer is likely to be "it depends." I am just
interested in whether one is more idiomatic/functional than the other,
performance issues that one approach may have that the other one
doesn't, etc.

Thanks in advance,

PS: I'm even tempted to say that if one could do (map (+ 2) [1 2 3 4
5]) it would look even better :)

U

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