keyword with slash to string

2011-12-05 Thread finbeu
Hello, weird, I know, but I have keywords in a map like this: :first/second I want to convert such a keyword to a string and I'm doing this with the name function. This doesn't work with a slash: (def x :first/second) (name x) second (The reason why I have such keywords at all is that

Re: keyword with slash to string

2011-12-05 Thread Meikel Brandmeyer (kotarak)
Hi, (defn to-string-keys [the-map] (into (empty the-map) (for [[k v] the-map] [(if-let [nspace (namespace k)] (str nspace / (name k)) (name k)) v]))) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: keyword with slash to string

2011-12-05 Thread finbeu
I'm impressed. Thank you very much! -- 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

Re: keyword with slash to string

2011-12-05 Thread Meikel Brandmeyer (kotarak)
Hi, keywords can qualified - just as symbols. Compare: :foo, :user/foo, ::foo (assuming you are in a fresh REPL). You can also use namespace aliases: (require '[some.name.space :as short]) ::short/foo. (shameless-promotion self http://bit.ly/cqbm6F) Sincerely Meikel -- You received this