Hi!
Am 24.08.2009 um 18:31 schrieb Dragan Djuric:
> I needed (and created) a macro to generate keywords from symbols. I
> couldn't find anything ready, and I am still not completely
> comfortable with the solution I came up with. Any suggestions for
> improvement?
If I understand you correctly, you'd like to convert symbols which
name vars to keywords qualified with the namespace which contains the
var's definition. You don't really need a macro for that, a regular
function will do. Here's a version using var metadata:
(defn resolve-to-kw [sym]
(let [md (meta (resolve sym))]
(keyword (-> md :ns ns-name name) (-> md :name name))))
Hope this helps.
Kind Regards,
Achim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---