On Mon, Aug 3, 2009 at 5:43 PM, samppi <rbysam...@gmail.com> wrote: > I'm getting stuck because a-map always gets passed into my-macro > as a symbol. > > (defmacro my-macro [a-map & forms] ; Naive implementation > `(binding ~(vec (process-a-map a-map)) ~...@forms))
Try (defmacro my-macro [a-map & forms] ; Naive implementation `(binding ~(vec (process-a-map ~a-map)) ~...@forms)) If you want something included not as a symbol, precede it with a ~ (does the same thing , does in common lisp). You already have ~...@forms which just does the same thing, except that if forms is a list it is appended to the list it's in rather than inserted as a single item. If bar = (+ 2 3): `(foo bar) => (foo bar) `(foo ~bar) => (foo (+ 2 3)) `(foo ~...@bar) => (foo + 2 3) Takes some getting used to, but once you master Lisp macros, it's Katie bar the door. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---