[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tentative Proposal: '() vs #F



Regarding for the '() vs #F stuff, I agree with the sentiment that IF et al
should be unspecified for non-boolean test expressions (I tend to be a type
freak) but I concur with Jinx's position that the list termination object is
(and should be) arbitrary.

 I find it intriquing to consider introducing a new distinguished object
#!END-OF-LIST (which presumably satisfies EOL-OBJECT?  but not NULL?) so that
for example (CONS '() '()) will print like ( () .  () ), which gives me nice
external represention for (say) binary trees implemented as (LEFT .  RIGHT)
pairs.  This is of type (PAIROF NULL NULL) and *not* of type (LISTOF NULL)
since (LISTOF NULL) is a widget that terminates in #!%END-OF-LIST (you know,
that invisible ".  ()" which traditional PRINTers dont print).  I then could
distinguish PAIRs from LISTs as follows:

(x . y) is of type PAIR iff y is not #!%*END-OF-LIST
(x . y) is of type LIST iff y is either a LIST or #!%*&END-OF-LIST
()      is an honorary (distinguished) LIST which is also NULL; it is the unique
        object which NULL? recognizes and respects. It is *not* a PAIR.

#!%*&^END-OF-LIST is a distinguished object whose type is THE-END-OF-LIST and
which is distinct from all other types.  It really need not have an enternal
represenation (since presumably we like our PRINTERs to suppress printing it
anyway, just as we dont want to have to type it in our input).  It's type
predicate is named EOL-OBJECT?  which is of the same stature as EOF-OBJECT?
(with respect to the END-OF-FILE object ).

All this is to say that:

 - I like booleans as distinct types
 - I like '() to denote "The Empty List"  [i.e. (NULL? '()) ==> #T ]
 - I like making a distinction between "The Empty List" and "The End Of List"
          (they just happen to be the same in "traditional" Lisps... which is
           to say that they identify "The Empty List" as the list which
           contains only "The End Of List" object).
 - I like (in view of the above) to distinguish the BOOLEAN? objects [viz. #T
           and #F] from the NULL? object [viz. '() ] from the EOL-OBJECT?
           object [viz. <it has no name>]
 - I like to think that (CONS x '()) is a PAIR (not a list) whereas (LIST x)
          is a LIST *and* a PAIR.
          (Note that if the EOL-OBJECT?  object were to have an external
           represenation then we could say that (CONS x #u) = (LIST x) ...
           where I use #u to annotate the unit type EOL-OBJECT?  which has only
           itself as member, but I am sure ever reader has a far better
           represenation in mind...  like #<fnord>)

 To summarize:
 
     "BOOLEs are BOOLEs and
       NULLs are NULLs  and
        EOLs are EOLs   and
      never the thwain shall meet"  ["thwain" = (1+ "twain") in Lithp ?]
   
Pedagogically, I think this is cleaner than the traditional NULL=EOL pun.
Consider this to be a tentative proposal.  That is, have I just taken the
cowards way out by saying "Let's introduce yet another gratuitous distinguished
object/type" or do you feel this actually has merit?

								~Ziggy