Thomas, Try this:
(defmacro my-macro2 [func & args] `(~func ~@(flatten (eval (vec args))))) Marc On Wed, Apr 18, 2012 at 4:57 PM, thomas kalbe <thomas.ka...@googlemail.com>wrote: > Hi, > > I'd like to write a macro which transforms > > (my-macro SomeClass. a b [x y] c [e f]) > > into > > (SomeClass. a b x y c e f) > > (the order of collections and single values in the arguments should be > arbitrary) > > The closest I came was > > (defmacro my-macro [func & args] > `(~func ~@(flatten args))) > > This works for simple cases like > > (my-macro SomeClass. 1 2 [3 4] 5) > > but clearly breaks when I do > > (def a [1 2]) > (def b [3 4]) > (my-macro SomeClass. a b) : > > (macroexpand-1 '(my-macro SomeClass. a b)) > => (SomeClass. a b) > > "flatten" seems the wrong way to do that. But I somehow need to evaluate > the forms in the args before the unqoute splice happens. > How would I do that? > Any ideas would be greatly appreciated. > > - thomas > > -- > 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+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en> -- 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