Why () not evaluate to nil?

Started by anemo, February 27, 2011, 12:45:40 PM

Previous topic - Next topic

anemo

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.

Lutz

#1
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">http://www.newlisp.org/downloads/newlis ... l_and_true">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">http://www.newlisp.org/index.cgi?page=Links

cormullion

#2
In Clojure, nil and the empty list ("()") are not the same. Scheme doesn't have a value named nil. So weirdness is relative :)

anemo

#3
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.