(dolist (x some-list) ... ) are actually persistent and remain to be listed later by (symbols). If this dolist is in a definition, then subsequently deleting 'x results in the definition failing next time it is used. If there was an existing x with a value other than nil, then it remains unchanged, as expected, so it isn't obvious that one would otherwise have been created.
Code: Select all
> (50 5 (symbols))
(add address amb and append)
> (define (scratch) (dolist (add-it '(x y z)) "done"))
(lambda ()
(dolist (add-it '(x y z))
"done"))
> (50 5 (symbols))
(add add-it address amb and)
> (scratch)
"done"
> (delete 'add-it)
true
> (scratch)
ERR: symbol is protected in function dolist : nil
called from user defined function scratch
>
Since I can't remember what might actually be used in a definition somewhere, I shall leave them all alone from now on. Maybe I should just settle on one name for this 'tempory' symbol, and always use that. 'Temp' might be a good name!
Regards, John
(Edited to add code)