To get a handle on a Java instance method which we can invoke later on, we can call the memfn function:
user=> (def g (memfn Integer/toString))
#'user/g
user=> (g 789)
"789"
This doesn't work for Java static methods:
user=> (def g (memfn Integer/toHexString))
#'user/g
user=> (g 789)
IllegalArgumentException No matching method found: toHexString for class java.lang.Long clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:52)
user=> (g)
ArityException Wrong number of args (0) passed to: user$g clojure.lang.AFn.throwArity (AFn.java:437)
How can we get a handle to a Java static method, so we can invoke it later on?
#(.foo ...), is generally preferred over memfn, so too would it be for static methods.