Re: Applying static java method to seq

2009-11-02 Thread ataggart
Good point about type-hinting. On Nov 2, 11:42 am, Chouser wrote: > On Mon, Nov 2, 2009 at 3:32 PM, ataggart 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 IF

Re: Applying static java method to seq

2009-11-02 Thread Richard Newman
> 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. That's not a first-class function call. All first-class functions need to be callable, but not al

Re: Applying static java method to seq

2009-11-02 Thread Kevin Downey
(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 wrote: > > If (Integer/parseInt "5") works, then not all functions need be an > implementation of IFn; or perhaps

Re: Applying static java method to seq

2009-11-02 Thread Chouser
On Mon, Nov 2, 2009 at 3:32 PM, ataggart 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 m

Re: Applying static java method to seq

2009-11-02 Thread ataggart
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

Re: Applying static java method to seq

2009-11-02 Thread Richard Newman
> 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 function

Re: Applying static java method to seq

2009-11-02 Thread John Harrop
On Mon, Nov 2, 2009 at 12:29 PM, Thomas 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_SOURC