Hi Alex, I had to ~(keyword (str sym)) instead of ~(keyword sym), but now it works well.
Cheers, -John On Thu, Nov 12, 2009 at 12:40 AM, Alex Osborne <a...@meshy.org> wrote: > John Ky wrote: > > Hi all, > > > > I'm looking for a way to write a defkw macro so that (defkw ABSENT) > > expands to > > (def ABSENT (kw "ABSENT" :ABSENT )). > > > > Just use `(...) as a template and use ~ to unescape, like so: > > (defmacro defkw [sym] > `(def ~sym (kw ~(str sym) ~(keyword sym)))) > > (defkw ANSEMT) > => (def ABSENT (kw "ABSENT" :ABSENT)) > > -- > 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<clojure%2bunsubscr...@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 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