Hi,

On 30 Sep., 09:48, Ulises <ulises.cerv...@gmail.com> wrote:

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

You can also consider the following: (map #(+ % 2) [1 2 3 4]), which
is also very clear. I personally almost never use partial. (partial +
2) is not entirely equivalent to #(+ 2 %) - actually it's #(apply + 2
%&) - but for 95% of my use cases the #() form is sufficient, shorter,
easier to read for me. partial is just a special case of #(). So in
the end it's probably personal preference.

Sincerely
Meikel

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