Hey, I really appreciate your help guys. This is very useful. On 02/12/2013 10:45 AM, Meikel Brandmeyer (kotarak) wrote: > You can also do away with the argument names. You just need the number of > arguments. > > (defn call-fn > [class method n-args] > (let [o (gensym) > args (repeatedly n-args gensym) > [class method] (map symbol [class method])] > (eval > `(fn [~o ~@args] > (. ~(with-meta o {:tag class}) > (~method ~@args)))))) > > user=> (def f (call-fn "java.io.File" "renameTo" 1)) > #'user/f > user=> (f (java.io.File. "foo") (java.io.File. "bar")) > false > > Meikel > -- > -- > 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/groups/opt_out. > >
-- -- 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/groups/opt_out.