Would memfn not work for you?

http://clojure.org/java_interop


On Thu, Feb 5, 2009 at 7:24 PM, kyle smith <the1physic...@gmail.com> wrote:

>
> I often need to call a java method on each element in a collection.  I
> didn't find anything on the group, so I wrote a macro.
>
> (defmacro map-method [method coll & args]
>  "Calls the given method on each item in the collection."
>  `(map (fn [x#] (. x# ~@(if args
>                         (concat (list method) args)
>                         (list method)))) ~coll))
> >
>

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