Go to the first, previous, next, last section, table of contents.

Where the Empty List Got its Name

Now that you understand Scheme lists and simple quoting, I can explain why the null pointer is called "the empty list," and written '().

Consider a list foo of three elements:

'(1 2 3)

The cdr of that list is a list (2 3). We could write a literal list like that as '(2 3)

The cdr of that list is a one-element list, (3). We could write a literal list like that as '(3).

The cdr of that list is a zero-element list, (), that is, it's the empty list. We could write it in quoted form as '().

Given the way that Scheme lists work, a list of zero items is the same thing as a null pointer, and it's natural to for Scheme to print it as a list with zero elements, ()---and for you to write it as a literal with a single quote, '().


Go to the first, previous, next, last section, table of contents.