Hi Alex,
> Sets are treated as predicate functions which are valid when they produce a logically true value.
So then my question boils down to:
Why is then (boolean (quote nil)) => false and (boolean (quote
anything)) => true?
And this boils down to:
Why a type of quoted symbol (type (quote nil)) is nil and not
clojure.lang.Symbol as is it the case for (type (quote anything))?
Here the source says:
(defn type
"Returns the :type metadata of x, or its Class if none"
{:added "1.0"
:static true}
[x]
(or (get (meta x) :type) (class x)))
And if I put few println's here, I see that in both cases (type (quote
nil)), (type (quote anything)) the input arg x is nil, IOW the
information "the arg x has a type of quoted symbol" is lost here. IOW
the clojure.core/type eagerly reports the type of e.g.:
(type (quote true)) => java.lang.Boolean
(type (quote "foo")) => java.lang.String
(type (quote nil)) => nil
(type (quote 1)) => java.lang.Long
etc. when I expect clojure.lang.Symbol, as for:
(type (quote anything)) => clojure.lang.Symbol
Hmm... *if* this type-hiding is a bug then I guess it's crawling too
deeply to fix it, right? :)
Anyway, thank you for your response, Alex!
Bost
> 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+u...@googlegroups.com.