If (Integer/parseInt "5") works, then not all functions need be an
implementation of IFn; or perhaps more precisely, clojure knows when a
call is being made to an IFn vs a static java method.  It would be
nice for consistency if whatever makes that work also treated Integer/
parseInt as a function with respect to higher-order functions such as
map.  Even the naive implementation of just automatically wrapping
such uses in an anonymous function would go a long way to removing
boiler-plate.




On Nov 2, 11:03 am, Richard Newman <[email protected]> wrote:
> > Direct references to methods don't work in higher-order functions  
> > for some reason.
>
> The reason is simply that Java methods are not first-class objects in  
> Clojure.
>
> Clojure functions are classes that implement IFn, and thus can be  
> passed around as objects. That's all higher-order functions are.
>
> The reason the anonymous function technique works is that it creates a  
> class that implements IFn, which just happens to call the Java method  
> you want.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to