On Sat, Nov 14, 2009 at 12:49 PM, Kevin Q <kevin.jing....@gmail.com> wrote:

> I have a list of agents, each of which has a hasmap state. I want to
> get a list of values from the list of agents, naturally I used the map
> function and print the result of the map:
>
> (println
>  (map #(@%) agents))
>
> However, when I run this, I got error "Wrong number of args passed to:
> PersistentHashMap"
>
> I'm wondering why is this happening?


For situations like this, I find it handy to discover what reader-macros are
expanding to. This works well:

user=>(defmacro expand [arg] (println arg))
#'user/expand
user=>(expand #(@%))
(fn* [p1__6536] ((clojure.core/deref p1__6536)))

So it will have the same effect as (map deref agents), though the latter is
clearer.

I don't know why it's failing, but it seems unlikely that switching to (map
deref agents) will fix it.

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