Awesome :) On Tuesday, February 12, 2013 9:51:01 AM UTC-3, Meikel Brandmeyer (kotarak) wrote: > > Hi, > > if you want to resort to eval you can define your own function on the fly. > > (defn call-fn > [& args] > {:arglists ([class method & args])} > (let [o (gensym) > [class method & args] (map symbol args)] > (eval > `(fn [~o ~@args] > (. ~(with-meta o {:tag class}) > (~method ~@args)))))) > > user=> (set! *warn-on-reflection* true) > true > user=> (def f (call-fn "java.io.File" "renameTo" "dest")) > #'user/f > user=> (f (java.io.File. "foo") (java.io.File. "bar")) > false > > Kind regards > 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.