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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---