Push não modifica a lista, sendo um argumento de função
Eu sou novo no lisp comum, então espero que alguém me esclareça isso:
digamos que temos uma lista e queremos adicionar um item compush
para modificá-lo:
CL-USER> (defparameter xx '(1 2 3))
XX
CL-USER> xx
(1 2 3)
CL-USER> (push 100 xx)
(100 1 2 3)
CL-USER> xx
(100 1 2 3)
como esperado. Mas quando tento fazer o mesmo com a função, ela não modifica uma lista:
CL-USER> (defun push-200 (my-list)
(push 200 my-list))
PUSH-200
CL-USER> (push-200 xx)
(200 100 1 2 3)
CL-USER> xx
(100 1 2 3)
então eu tentei comparar o argumento e minha lista assim:
CL-USER> (defun push-200 (my-list)
(format t "~a" (eq my-list xx))
(push 200 my-list))
WARNING: redefining COMMON-LISP-USER::PUSH-200 in DEFUN
PUSH-200
CL-USER> (push-200 xx)
T
(200 100 1 2 3)
CL-USER> xx
(100 1 2 3)
diz que os objetos são idênticos. Então a pergunta é: qual foi a coisa que eu negligenciei aqui?