Is there any reason why a .method occurrence in non-operator position
doesn't just do the closure wrapping automagically?

-Per

On Thu, Mar 18, 2010 at 9:50 PM, Stuart Halloway
<stuart.hallo...@gmail.com> wrote:
> memfn is from the depths of time and should be deprecated -- it is idiomatic
> to write an anonymous fn around the method.
>
> Stu
>
>> This seems like a potential usecase for (memfn):
>>
>> -------------------------
>> clojure.core/memfn
>> ([name & args])
>> Macro
>>  Expands into code that creates a fn that expects to be passed an
>>  object and any args and calls the named instance method on the
>>  object passing the args. Use when you want to treat a Java method as
>>  a first-class fn.
>>
>> user> (= (map (memfn getName) (-> (Runtime/
>> getRuntime) .getClass .getMethods seq))
>>        (map #(.getName %) (-> (Runtime/
>> getRuntime) .getClass .getMethods seq)))
>> true
>>
>>
>> On Mar 18, 6:21 am, Meikel Brandmeyer <m...@kotka.de> wrote:
>>>
>>> Hi,
>>>
>>> Java methods are not clojure functions. To treat them like first-class
>>> functions you have to wrap them in clojure functions as you did in
>>> your second example.
>>>
>>> For your actual task: you might want to look at clojure.contrib.repl-
>>> utils/show.
>>>
>>> Sincerely
>>> Meikel
>>
>> --
>> 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
>
> --
> 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

-- 
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

Reply via email to