Neat tip.
Applying that, this is what I've come up with:

(defn jcall [obj name & args]
  (clojure.lang.Reflector/invokeInstanceMethod obj (str name)
    (if args (to-array args) clojure.lang.RT/EMPTY_ARRAY)))
(defn map-obj [jobj jmeth coll & colls]
  (apply map #(apply jcall jobj jmeth %&) coll colls))

(map-obj "Timothy" 'charAt (range 7))
-> (\T \i \m \o \t \h \y)
(map-obj "Timothy" 'substring (iterate inc 0) [3 5 4])
-> ("Tim" "imot" "mo")
(map-obj "Timothy" 'regionMatches [0 1 0] ["Tim" "Jim" "Jim"] [0 1 0]
[3 2 3])
-> (true true false)

no more (i j) and also no need for the lazy-self seq as the lamda
closes the object, looks like you've killed two of my birds with one
function :)
Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to