Yikes! Try ((juxt (comp ns-name :ns) :name) (meta (resolve 'inc))) - name
information is stored on the var's meta in a clojure-friendly way - no need
to use undocumented behavior on the java internals.
On Monday, November 12, 2012 11:05:15 AM UTC-8, Ambrose Bonnaire-Sergeant
wrote:
Evil, but this is the solution I use:
(let [v (resolve 'a)]
(symbol (str (ns-name (.ns v))) (str (.sym v
I'd love to know a better way.
Thanks,
Ambrose
On Tue, Nov 13, 2012 at 1:46 AM, johnstok k.w.jo...@gmail.comjavascript:
wrote:
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.comjavascript:
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 javascript:
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--
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