The function you give to map needs to accept the same number of args
as there are collections.  You're passing one map, thus the function
will be called with one arg. In the case of maps the "element" is a
key/value pair, which can then be destructured in the function.

On Apr 15, 8:53 pm, Derek <dere...@gmail.com> wrote:
> I feel like I'm probably doing something dumb, but here's my problem.
> Below is a function that could take two maps, and return a list of all
> the values in the second map for each key of the first:
>
> (defn foo [map1 map2] (map (fn [k v] (map2 k)) map1))
> (foo {:a 1 :b 2} {:a 5 :b 6 :c 7})
>
> I would expect this to evaluate to:
> [5 6]
>
> When trying this code in clojure, I receive this error:
> java.lang.IllegalArgumentException: Wrong number of args passed to:
> user$foo--19$fn
>
> It seems as if the compiler hasn't generated an anonymous function
> with appropriate arity, but I'm not sure what I'm doing wrong. Any
> tips would be appreciated.
>
> Derek
>
> --
> 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 
> athttp://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