In 1.9 there is a new ident? function which covers keywords and symbols. If
you want to include strings, you would have to make that yourself though.
On Tuesday, February 7, 2017 at 9:44:55 AM UTC-6, Dave Tenny wrote:
>
> 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 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
---
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.