Why () not evaluate to nil?

Pondering the philosophy behind the language
Locked
anemo
Posts: 6
Joined: Sun Jan 09, 2011 5:09 pm

Why () not evaluate to nil?

Post by 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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Why () not evaluate to nil?

Post by Lutz »

There is a chapter about this in the newLISP Users Manual Chapter "10. nil, true, cons, and ()"

http://www.newlisp.org/downloads/newlis ... l_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 (*):
Almost 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

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: Why () not evaluate to nil?

Post by cormullion »

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

anemo
Posts: 6
Joined: Sun Jan 09, 2011 5:09 pm

Re: Why () not evaluate to nil?

Post by anemo »

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.

Locked