(Integer/parseInt "5") is actually (. Integer parseInt "5") which works fine because "." is the operator position, and "." is a special form
On Mon, Nov 2, 2009 at 11:32 AM, ataggart <alex.tagg...@gmail.com> wrote: > > 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 <holyg...@gmail.com> 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. > > > -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---