Thanks, that worked great!
Since my func came from a different namespace, the following seems to
work ok.

(defn dispatcher [name-space func-name alist]
  (apply (ns-resolve *ns* (symbol func-name)) alist))

I am able to invoke this from my java code:
        RT.loadResourceScript(pathScript);
        Var function = RT.var(namespace, "dispatcher");
        Object result = function.invoke(namespace + "/" + functionName,
argList);

Thank you again.

On Sep 14, 8:46 am, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> Hello,
>
> one possibility:
>
> 1:15 user=> (defn func [arg] (println "func: " arg))
> #'user/func
> 1:16 user=> ((ns-resolve *ns* (symbol "func")) "laurent")
> func:  laurent
> nil
> 1:17 user=>
>
> HTH,
>
> --
> Laurent
>
> 2009/9/14 wireless <wirelessp...@gmail.com>
>
>
>
>
>
> > (defn func [arg] (println "func: " arg))
>
> > I'd like to invoke 'func' using the string name of the function,
> > something like:
> > ("func" "mytag")
>
> > Obviously, this would be answered with "java.lang.ClassCastException:
> > java.lang.String cannot be cast to clojure.lang.IFn"
>
> > I need to find a way to convert the string "func" to "IFn" somehow.
> > ((make-IFn "func") "mytag")
>
> > How is this done?
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
Note that posts from new members are moderated - please be patient with your 
first post.
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