Here are the ways two other languages treat this issue.
In Common Lisp, apparently
T and
NIL are also symbols.
Code: Select all
$ /opt/ccl/wx86cl64.exe
Welcome to Clozure Common Lisp Version 1.9-r15765 (WindowsX8664)!
? (symbolp t)
T
? (symbolp 't)
T
? (symbolp nil)
T
? (symbolp 'nil)
T
?
Not so, in this implementation of Scheme.
Code: Select all
$ /opt/Racket/mzscheme
Welcome to Racket v5.3.5.
> (symbol? #t)
#f
> (symbol? '#t)
#f
> (boolean? #t)
#t
> (boolean? '#t)
#t
> (boolean? #f)
#t
>
Apparently, in Scheme, both
#t and
#f belong to a type (informal?) called
boolean and they are NOT symbols (i.e. do not belong to the
symbol type), although they sort of look like self-evaluating symbols. Interesting.
In newLISP,
true and
nil are self-evaluating, but they are not symbols. At least they are not symbols strictly speaking (cf. Lutz's example
true versus
'true, where the latter is a symbol). This situation is more in line with the Scheme design choice, except where its boolean value
#t is not a symbol when quoted, but newLISP's
true is. Again, interesting.