Nope, still won't work. (let [s 'toString] (invoke 1 s))
java.lang.IllegalArgumentException: No matching field found: s for class java.lang.Long On Sun, Oct 18, 2015 at 5:51 PM dennis zhuang <killme2...@gmail.com> wrote: > You may have to use macro: > > user=> (defmacro invoke [obj sym] `(. ~obj ~sym)) > #'user/invoke > user=> (invoke 1 toString) > "1" > > 2015-10-19 6:54 GMT+08:00 Timur <timurha...@gmail.com>: > >> Hi all, >> >> Is there anyway to call an object member using its symbol? >> >> For instance we have an object o, we get the symbol of a method, e.g., >> toString, of our object o using clojure.reflect/reflect and and I want to >> execute this method on this object through the symbol. >> >> For instance *(. obj sym)* throws an exception. Here symbol for instance >> contains toString >> >> Any ideas about how I can do this? >> >> Regards, >> >> Timur >> >> -- >> 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 >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > 庄晓丹 > Email: killme2...@gmail.com xzhu...@avos.com > Site: http://fnil.net > Twitter: @killme2008 > > > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.