From: Vassil Nikolov
Subject: Re: Circular List
Date: 
Message-ID: <19980515165852.15237.qmail@nym.alias.net>
The problem has already been explained,
just two additional remarks:

On Fri, 15 May 1998 05:27:53 -0400, 
Gerald Smith  <··········@CompuServe.COM> wrote:

>(setf x '(foo bar) )
         ^^^^^^^^^^
>
>I want to mutate the first element of the list (...)

If you want to modify destructively, you cannot use '(FOO BAR);
you must use (LIST 'FOO 'BAR) or anything equivalent that
creates a fresh list.  (This kind of bug might just `lurk'
for a long time before it hits you.)

(...)
>Now I realize I have created a circular list (...)

This is not actually a circular list, at least not for
the usual definition of `circular,' though it does need
*PRINT-CIRCLE* to be true to be printed in finite time.
To circularise x:
  (setf (rest (last x)) x)
or
  (setf x (nconc x x))
with all due attention to destructive modifications.

Good luck,
Vassil.