Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!usc!samsung!uunet!mcsun!ukc!edcastle!aiai!jeff From: jeff@aiai.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.lisp Subject: Re: FALSE vs empty list Message-ID: <3409@skye.ed.ac.uk> Date: 12 Sep 90 20:01:59 GMT References: <24305@uflorida.cis.ufl.EDU> <1350029@otter.hpl.hp.com> Reply-To: jeff@aiai.UUCP (Jeff Dalton) Organization: AIAI, University of Edinburgh, Scotland Lines: 54 In article <1350029@otter.hpl.hp.com> sfk@otter.hpl.hp.com (Steve Knight) writes: >The type-distinctness of empty-list and false in a Lisp or Lisp-like >language is an aesthetic consideration. Many folks, and I'd include myself, >believe that making them distinct is more convenient and makes programs >more readable. Ultimately, our arguments must boil down to "I don't think >of an empty list and false in the same way. I don't think that applying >boolean operators to lists makes good programming practice." and so on. It is important to distinguish two different, but related, issues. 1. Should false and the empty list (and the symbol NIL) be distinct? 2. Should arbitrary objects other than the false value count as true, or should only one value count as true. I am happy to go either way on the first, though if pressed I'd probably prefer that the values be distinct. But on the second I feel very strongly that all non-false values should count as true. >If you are happy applying boolean operators to lists and list operators to >booleans, then you will have little inclination to change. You may even >enjoy the conciseness of idioms such as > (car (or (member x L1) (member x L2) '(()))) >which exploit the conflation of lists and booleans. This is issue number 2, but an example designed to make the "punning" look suspect. Moreover, it does not exploit the conflation of lists and booleans; it exploits the fact that any non-false value counts as true. (The key thing to notice is that MEMBER returns when the item is not found. This is made clear in Scheme but not in Common Lisp, where and the empty list are always the same.) >On the other hand, you may be inclined to wonder why only lists and booleans >should enjoy the benefits of conflation. For example, we could map 0 and >NIL onto one another & perhaps 1 onto TRUE. And this is issue number 1. Your article doesn't explicitly distinguish them, but I hope you would agree that that *can* be decided separately (even if you happen to think they shouldn't be). That said, let me make the following point. Arguments about issue number 1 don't necessarily apply to issue number 2. In particular, the argument that NIL, false, and the empty list ought to be distinct, and the argument that it's inconsistent (or something) to have only lists and booleans enjoy the benefits of conflation, are *not* arguments that there should be only a single value that counts as true. -- Jeff