[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
() and T.
- To: common-lisp at SU-AI
- Subject: () and T.
- From: Richard M. Stallman <RMS at MIT-AI>
- Date: Tue, 02 Mar 1982 03:43:00 -0000
I believe that () should be distinuished from NIL because
it is good if every data type is either all true or all false.
I don't like having one symbol be false and others true.
Another good result from distinguishing between () and NIL is
that the empty list can be LISTP.
For these reasons, I think that the Lisp machine should convert
to option 2 for NIL.
The situation for T is different. Neither of those advantages
has a parallel for the case of T and #T. It really doesn't matter
what non-() object is returned by predicates that want only to return
non-falsity, so the symbol T is as good as any. There is no reason
to have #T as distinct from T. However, option 3 is not really ugly.
Since one non-() value is as good as another, there is no great need
to require what value the implementation must use. I prefer option 1,
but I think option 3 is nearly as good.
Meanwhile, let's have the predicates SYMBOLP, NUMBERP, STRINGP and CONSP
return their arguments, to indicate truth. This makes possible the
construction
(RANDOM-FUNCTION (OR (SYMBOLP expression) default))
where default might eval to a default symbol or might be a call to ERROR.
To do this now, we must write
(RANDOM-FUNCTION (LET ((TEM expression))
(IF (SYMBOLP TEM) TEM
default)))
LISTP should probably return its argument when it is a non-() list.
(LISTP ()) should return some non-() list, also.
ATOM should return its argument if that is not ().
(ATOM ()) should return T. Then ATOM's value is always an atom.
The general principle is: if a predicate FOO-P is true if given
falsehood as an argument, FOO-P should always return an object
of which FOO-P is true.
If, on the other hand, FOO-P is false when given falsehood as an
argument, then FOO-P should always return its argument to
indicate truth.
These two principles can be applied whether or not () and NIL
are the same. If applied, they minimize the issue about T and #T.