.Bill Smith a écrit : > To take the extra Java class out of the loop, I wrote this second > macro: > > user=> (defmacro s [& args] `(java.util.Arrays/asList (into-array (map > str '~args)))) > #'user/s > user=> (let [c "value of c"] (s "1" c)) > #<ArrayList [1, c]> > user=> (macroexpand-1 '(s "1" c)) (java.util.Arrays/asList (clojure.core/into-array (clojure.core/map clojure.core/str (quote ("1" c)))))
while what you want is: (java.util.Arrays/asList (clojure.core/into-array (clojure.core/map clojure.core/str (list "1" c)))) You have to remove the quote, introduce 'list and use unquote-splicing (~@): user=> (defmacro s [& args] `(java.util.Arrays/asList (into-array (map str (list ~...@args))))) #'user/s user=> (let [c "value of c"] (s "1" c)) #<ArrayList [1, value of c]> Christophe --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---