On Mon, Feb 18, 2008 at 11:46:28PM -0800, Andrew Lentvorski wrote:
David Brown wrote:

When I take the 'cdr' of a list, I have a pointer to the second element of
the list.

No, you have a pointer to *another* list.

Yes, sorry for the confusion.  But, it isn't a pointer to a different list,
that's an important distinction.  This list is the same list as the list
starting at the second element of the first list.

In other words   (cdr x) is different than pythons x[1:] slice, which will
make a copy of the list starting at the second element.

Where it matters is if you do:

   (define x '(1 2 3 4 5))
   (set-car! (cdr x) 10
   x
     => (1 10 3 4 5)

David

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to