The code below has z as a local variable, but it behaves as if it were global:
(defun foo (m) (let ((z '(stuff nil))) (push m (getf z 'stuff)) (print z))) (foo 1) (foo 2) (foo 3)
I expect the conclusion to be
(STUFF (1)) (STUFF (2)) (STUFF (3)) T
but when I launch it using SBCL I see
(STUFF (1)) (STUFF (2 1)) (STUFF (3 2 1)) T
Why is this so? Is this behavior typical of property lists?
lisp common-lisp sbcl
carlo_hamalainen
source share