I've occasionally wanted this and haven't found it.
(defn named?
"True if object is compatible with the 'name' function.
There must be a clojure built-in to do this but I haven't figured it out
yet."
[x]
(or (string? x)
(keyword? x)
(symbol? x)))
Note that simply doing (instance? clojure.lang.Named x) won't work for
strings, but the (name) function does.
Anyway, I'm thinking there's a built in way to do this without defining the
above function. Suggestions?
My use case is simply that I want to call the name function for objects
that support it in a translation function.
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.