Rich wrote:
>
> As you can see, the lists appear to be maintained between calls.
> Redefining the function empties the lists again. This happens in
> OpenMCL and CLISP.
>
> Can anyone either (a) point out what I've done wrong, or (b) point me
> towards an existing function to allow me to deconstruct an argument
> list?
>
Try these:
(defun good (x)
(let ((l (list 0)))
(dotimes (i x)
(incf (car l)))
l))
(defun not-so-good (x)
(let ((l '(0)))
(dotimes (i x)
(incf (car l)))
l))
Then note that you are assigning literal list values to SPLITS and SUB.
Later when you modify those literal values you are effectively modifying
your source code. This is why you see the persistence from call to call.
David Sletten