I was looking at combining the namespace and resolve functions:
user=> (def x 5)
#'user/x
user=> (resolve 'x)
#'user/x
user=> (namespace 'user/x)
"user"
user=> (namespace 'x)
nil
user=> (namespace (resolve 'x))
ClassCastException clojure.lang.Var cannot be cast to clojure.lang.Named clojure.core/namespace (core.clj:1497)
In the final expression I was expecting to get the value "user".
Having read the doc's I understand that the return type from resolve is not compatible with namespace:
namespace: Returns the namespace String of a symbol or keyword, or nil if not present.
resolve: Returns the var or Class to which a symbol will be resolved in the current namespace else nil.
Question: given a symbol 'x' how can I determine the 'fully qualified' symbol (i.e. 'user/x')?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en