How embarrassing!

This works much better:

(defn str-invoke [method-str instance & args]
  (clojure.lang.Reflector/invokeInstanceMethod instance method-str (to-
array args)))

(let [ts "toString", ct "compareTo"]
  (println (str-invoke ts 5))
  (println (str-invoke ct 5 4))
  (println (str-invoke ct 5 5)))

ie: this is just using reflection as pmf suggested, however I think
this form is more convenient as Clojure's Reflector class does all the
hard work of matching the parameters for you. I'm sure someone will
post a macro solution, but hopefully this will do till then.


Regards,
Tim.


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