From: Barry Margolin
Subject: Re: sort under cmulisp16f
Date: 
Message-ID: <38os8o$7rv@tools.near.net>
In article <··········@falcon.ccs.uwo.ca> ·······@csd.uwo.ca (Michael Dent) writes:
>* (setq temp '(3 5 2 4 7 8))
>Warning:  Declaring TEMP special.
>
>(3 5 2 4 7 8)
>* (sort temp '<)
>
>(2 3 4 5 7 8)
>* temp
>
>(3 4 5 7 8)   !!

Remember that lists aren't first-class objects in Lisp.  They are made up
of conses, which are first-class.

In the above example, TEMP refers to the cons whose car is 3.  The SORT
function relinks the cdrs of the conses that make up the list.  But when
it's all done, TEMP must still refer to the same cons that it did prior to
the sort.

Also, when Common Lisp specifies that a function is destructive, in general
this only *allows* it to reuse the original data, it doesn't *require* it
to (a few functions have more specific definitions -- for instance, NCONC's
behavior is specified very precisely as setting the cdr of the last cons in
each list).  Therefore, you must reassign the variable in case the function
doesn't reuse the original list.
-- 

Barry Margolin
BBN Internet Services Corp.
······@near.net