我正在尝试在 Common Lisp 中编写一个从列表中删除项目的函数。这是我到目前为止所写的:
(defun aux-remove-fio (lst toremove)
(if (equal (first lst) toremove)
(pop lst)
(aux-remove-fio (rest lst) toremove))))
当我测试函数时,结果如下:
CG-USER(49): a3
((1 (1 . 1) (1 . 2)) (2 (2 . 1) (1 . 2)))
CG-USER(50): (pop a3)
(1 (1 . 1) (1 . 2))
CG-USER(51): a3
((2 (2 . 1) (1 . 2)))
CG-USER(52): (setf a3 '((1 (1 . 1) (1 . 2)) (2 (2 . 1) (1 . 2))))
((1 (1 . 1) (1 . 2)) (2 (2 . 1) (1 . 2)))
CG-USER(53): (aux-remove-fio a3 '(1 (1 . 1) (1 . 2)))
(1 (1 . 1) (1 . 2))
CG-USER(54): a3
((1 (1 . 1) (1 . 2)) (2 (2 . 1) (1 . 2)))
谁能解释为什么我的功能不起作用?