newLISP Fan Club

Forum => Whither newLISP? => Topic started by: anemo on February 27, 2011, 12:45:40 PM

Title: Why () not evaluate to nil?
Post by: anemo on February 27, 2011, 12:45:40 PM
Why doesn't () evaluate to nil?



it seems weird to be a lisp language and have that not be true.   Just a strange philosophical question I had when I hit something unexpected.



Just a random philosophical question I had.   To be honest it doesn't change much for me, but got curious since some "super serious 'other' lisp dude" would think that it's a big deal.
Title: Re: Why () not evaluate to nil?
Post by: Lutz on February 27, 2011, 02:40:09 PM
There is a chapter about this in the newLISP Users Manual Chapter "10. nil, true, cons, and ()"



http://www.newlisp.org/downloads/newlisp_manual.html#nil_and_true



This and related matters are also discussed in The Evolution of Lisp - Gabriel and Steele 1993. The following quote is taken from chapter 3.1 (*):


QuoteAlmost since the beginning, Lisp has used the symbol nil as the distinguished object that indicates the end of a list (and which is therefore itself the empty list); this same object also serves as the false value returned by predicates. McCarthy has commented that these decisions were made "rather lightheartedly" and "later proved unfortunate."


(*) a link to this book can be found on this page: http://www.newlisp.org/index.cgi?page=Links
Title: Re: Why () not evaluate to nil?
Post by: cormullion on February 27, 2011, 03:06:48 PM
In Clojure, nil and the empty list ("()") are not the same. Scheme doesn't have a value named nil. So weirdness is relative :)
Title: Re: Why () not evaluate to nil?
Post by: anemo on February 28, 2011, 09:37:54 AM
Guess it was just a surprise for me :D



And a bigger one than I would have thought with () evaluating to nil being considered an unfortunate decision.