Cool... that looks like it got me past the 'method-as-a-string' problem, but now I'm getting errors with not finding a matching method on the class by that name. I'm guessing that this means there was a problem matching the type signature of the method.
The arguments to the method are stored in a 'clojure.lang.PersistentVector', and if I duplicate the method I'm trying to access but set the only parameter to be typed as 'clojure.lang.PersistentVector', then it works. The new method with the new type signature works. Which to me means that we're passing all the arguments to the method still inside their original vector - right?
I guess I'm still stuck on how to expand the vector of arguments in place... and I'm really not very sure what you're doing with the '&' in the parameters for the str-invoke. Is that a way of slurping all the remaining parameters into a vector? If so, then aren't I needing to do the opposite?
I tried removing the &, and into-array - that didn't work. I tried changing the method into a macro so I could splice in the vector of args - that didn't work. This is getting frustrating. Everything else has been so relatively easy to do until now.
I really appreciate your help in walking me through my lack of understanding.
If I'm following you correctly I think we're here:
user=> (defn str-invoke [instance method-str & args] (clojure.lang.Reflector/invokeInstanceMethod instance method-str (into-array args)))
#'user/str-invoke
user=> (def i "sampleString")
#'user/i
user=> (def m "substring")
#'user/m
user=> (def args [2,3])
#'user/args
user=> (str-invoke i m args)
java.lang.IllegalArgumentException: Unexpected param type (NO_SOURCE_FILE:0)
user=> (str-invoke i m 2 3)
"m"
user=>
-Rich