How to convert a clojure keyword into a string?

Actually, it's just as easy to get the namespace portion of a keyword:

(name :foo/bar)  => "bar"
(namespace :foo/bar) => "foo"

Note that namespaces with multiple segments are separated with a '.', not a '/'

(namespace :foo/bar/baz) => throws exception: Invalid token: :foo/bar/baz
(namespace :foo.bar/baz) => "foo.bar"

And this also works with namespace qualified keywords:

;; assuming in the namespace foo.bar
(namespace ::baz) => "foo.bar"  
(name ::baz) => "baz"

Note that kotarak's answer won't return the namespace part of keyword, just the name part - so :

(name :foo/bar)
>"bar"

Using his other comment gives what you asked for :

(subs (str :foo/bar) 1)
>"foo/bar"

user=> (doc name)
-------------------------
clojure.core/name
([x])
  Returns the name String of a string, symbol or keyword.
nil
user=> (name :var_name)
"var_name"

Tags:

Clojure