On Mon, Nov 2, 2009 at 12:29 PM, Thomas <thomas.g.kristen...@gmail.com>wrote:

> How come I can do this
>
> user=> (map #(Integer/parseInt %) ["42" "100"])
> (42 100)
>
> but not this
>
> user=> (map Integer/parseInt ["42" "100"])
> java.lang.Exception: Unable to find static field: parseInt in class
> java.lang.Integer (NO_SOURCE_FILE:2)
>
> I understand that Clojure is trying to look up Integer/parseInt to a
> field, but I don't understand why.


Direct references to methods don't work in higher-order functions for some
reason. The first form has to be used, or else memfn which just creates a
wrapper similar to #(class/method args).

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