Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!titan!dorai From: dorai@titan.rice.edu (Dorai Sitaram) Newsgroups: comp.lang.lisp Subject: Re: Overloading of NIL (as empty list and logical falsity) Message-ID: <2906@kalliope.rice.edu> Date: 22 Mar 89 21:43:10 GMT References: <8247@csli.STANFORD.EDU> <9840@megaron.arizona.edu> Sender: usenet@rice.edu Reply-To: dorai@titan.rice.edu (Dorai Sitaram) Distribution: na Organization: Rice University, Houston Lines: 36 In article <9840@megaron.arizona.edu> mike@arizona.edu (Mike Coffin) writes: $From article <8247@csli.STANFORD.EDU> (Mark Johnson): $[Speaking of the overloading of nil and the empty list in Lisp] $$ Does anybody else have any comments on the matter? Do more advanced $$ functional languages (ML?) incorporated the same overloading of NIL? $ $Scheme has distinct values for false and the empty list: #F and '(), $respectively. Any Scheme value can be used as a boolean value for the $purpose of a conditional test. Any value except #F and the empty list $count as "true"; #F and the empty list count as "false". This seems $to be the best of both worlds to me... Which Scheme is this? In all the Schemes I've come across, #f and '() are just two ways of writing the same object. They are indistinguishable from each other, i.e., (eq? #f '()) ==> true. A unification algorithm written in Scheme that used '() as the empty substitution list and #f to indicate failure would bomb because of the false/empty-list schizophrenia. It is perhaps helpful not to think of the-empty-list as a given in Lisp/Scheme. Consider that we're given the numbers, booleans t and nil, characters and other basic constants of your choice. Added to this, we now are given the ability to form dotted pairs (cons), with which we can form data-types of our choice. _One_ of the user data-types that we can create from the above givens is something called a list, which is distinguished by its having a nil finally when one traverses down its dotted-pair representation in a rightmost fashion. This way, nil is just a user-representation for the user's empty list concept, and _we_ are doing the overloading of nil, _not_ Lisp. Feel better? ;-) As an aside, Lisp would be more accurately though less euphonically described as Dottedpaip. --dorai