Hi, I was wondering whether there was an elegant way to make this macro do more work:
(defmacro define-template [template-name & template-params] `(def ~template-name (apply merge (map (fn [[k# v#]] {(keyword k#) (var-get (resolve v#))}) (partition 2 2 '~template-params))))) It's meant to be called like this: (define-template some-template-name page some-function-1 posts some-function-2 post some-function-3) It defs a var called some-template-name bound to a map that looks like this: {:page some-function-1 :posts some-function-2 :post some-function-3} But I'm not sure I've written the macro as well as it could be done, no doubt due my own ignorance. The mapping function call that the macro emits will do quite a bit of work to create the map that I want. I was thinking maybe there's more work that the macro can do during the macro expansion phase. If you need more context, please have a look at this code: http://github.com/finalprefix/blog-in-15-minutes/blob/master/test/tests.clj It's basically toy project to get to know clojure/macros/emacs/compojure better. Thanks in advance for you thoughts! Joel Rosario. -- 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