|
From: | Kevin Rodgers |
Subject: | Re: Documentation for car and cdr |
Date: | Thu, 26 Jan 2006 15:17:25 -0700 |
User-agent: | Mozilla Thunderbird 0.9 (X11/20041105) |
Peter Whaite wrote:
Luc Teirlinck <address@hidden> wrote:The only list that is not a cons cell is nil.Actually I seem to remember learning that nil _was_ a cons cell where both the car and cdr pointed to itself. That makes it unnecessary to treat nil as a special case. But that was a long time ago.
I learned Lisp 20+ years ago, and nil has always been an atom (in fact, a symbol whose value is itself, just like t and now keywords). A cons cell like you describe would be a circular structure: +----+ +----+ | | | | | v v | | +---+---+ | | | | +--+ | +-+-+---+ | | +----+ (let ((print-circle t) (cons-cell (cons nil nil))) (setcar cons-cell cons-cell) (setcdr cons-cell cons-cell) cons-cell) ==> (#0 . #0) If the symbol nil had such a value, (eq nil 'nil) would not be true. -- Kevin Rodgers
[Prev in Thread] | Current Thread | [Next in Thread] |