MC logo

Spam Set to Own Cdr


Lisp Reference Counting Question

Setting spam to its own cdr moves the pointer down right one node. The node spam used to point to must have its reference count reduced, and the new node must have its count increased. This makes the counts zero (for the node pointing to tape) and two (for the node spam now points to). The zeroed node is deleted, along with its pointer. This reduces the spam node's count back to one.

<<
>>