Re: map-method

2009-02-05 Thread Jeffrey Straszheim
Good point, and a good reason for a macro. On Thu, Feb 5, 2009 at 8:50 PM, kyle smith wrote: > > Of course those would work, but I got sick of typing them over and > over. > > (map-method length ["mary" "had" "a" "little" "lamb"])

Re: map-method

2009-02-05 Thread kyle smith
Of course those would work, but I got sick of typing them over and over. (map-method length ["mary" "had" "a" "little" "lamb"]) (map-method indexOf ["mary" "had" "a" "little" &qu

Re: map-method

2009-02-05 Thread Nathan Kitchen
1 1) On Feb 5, 5:05 pm, Jeffrey Straszheim wrote: > Would memfn not work for you? > > http://clojure.org/java_interop > > On Thu, Feb 5, 2009 at 7:24 PM, kyle smith wrote: > > > I often need to call a java method on each element in a collection. I > > didn't fin

Re: map-method

2009-02-05 Thread Jeffrey Straszheim
Would memfn not work for you? http://clojure.org/java_interop On Thu, Feb 5, 2009 at 7:24 PM, kyle smith 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

map-method

2009-02-05 Thread kyle smith
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