On Sat, Nov 14, 2009 at 3:24 PM, John Harrop <jharrop...@gmail.com> wrote:

> On Sat, Nov 14, 2009 at 2:51 PM, Kevin Q <kevin.jing....@gmail.com> wrote:
>
>> Hi,
>> Thanks for the hint. I tried (map deref agents) and it did work. I
>> don't know if this is a bug?
>
>
> Nah, it's just being really sneaky.
>
>
>>  > (fn* [p1__6536] ((clojure.core/deref p1__6536)))
>>
>
> Even I didn't notice it before. There's an extra pair of parens, so it's
> double-dereferencing. The problem is that #() brings in one pair, and @ in
> expanding to (deref the-argument) brings in a second.
>

As for the seemingly irrelevant error message: I guess the agent's state was
a map, so it deref'd it and then invoked the map. Maps can be invoked, but
expect one argument (a key to look up) and it got zero. If the error had
been cannot cast to IFn, it would have been more apparent what was happening
quicker. There isn't much that can be done about the error message confusion
in cases like this, though; it goes with the territory of having a highly
dynamic language. Learning to interpret them is an art, one I'm still
mastering.

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