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
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to