On May 11, 2010, at 12:39 PM, Alexandre Patry wrote: > I am trying to call a java method using apply, like : > > (apply .println [System/out "hello" "world"]) > > But I get an error: "Unable to resolve symbol: .println in this context" > > Am I missing something?
Unfortunately, Java methods are not currently first-class functions in Clojure. But you can use memfn to create one (see "Java Interop" section at clojure.org): (apply (memfn println s) [System/out "hello world"]) (Note that your original version won't work because println only takes one String argument.) You can also do (apply #(.println %1 %2) [System/out "hello world"]), of course. -- 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