Common Lisp:从给定指向它的指针的列表中删除嵌套列表

I'm wondering if it's possible to remove a nested list from a list, given a pointer to the nested list. E.g., suppose we say (defvar y '(1 2 3)) and (defvar x (list 4 5 y 6 7)). Now X is (4 5 (1 2 3) 6 7). Is there a way to use Y to modify X to (4 5 6 7)?

(setf y nil) doesn't modify X, so it doesn't have the expected effect. The closest I've gotten is (rplacd y nil) which modifies X to (4 5 (1) 6 7).

评论