On Aug 25, 2013, at 2:43 PM, ngieschen <nickgiesc...@gmail.com> wrote:

> I'm somewhat new to clojure and trying to understand mapcat, so apologies in 
> advance if this is an embarrassingly elementary question.
>
> mapcat's signature is (f & colls) which indicates to me I should be able to 
> so something like (mapcat #(list (inc %)) [1 2 3] [4 5 6]). That is, doesn't 
> the & indicate that I can pass in a variable number of colls? However, if I 
> do, it crashes and burns, since internally it's calling (apply map #(list 
> (inc %)) '([1 2 3] '[4 5 6])), which, as expected, throws an ArityException.

Try this:

(mapcat #(list (+ %1 %2)) [1 2 3] [4 5 6])

The function f needs to accept a number of arguments equal to the
number of colls.

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to