Destructive Linked List Functions
All of the functions we have considered so far are constructive: they may construct new lists, but they do not modify their arguments. However, these functions sometimes share structure, i.e. the same list structure is part of more than one list.
(setq x '(a b c)) (setq y '(d e)) (setq z (append x y)) x -> (a b c) y -> (d e) z -> (a b c d e)
Appending x and y to form z did not change x and y. However, z and y now share structure.
Functions that modify their arguments are sometimes called destructive; they are useful, but must be used with care to make sure that shared structures are not inadvertently modified. If we made a destructive change to y, it would also change z.
(setf (first y) 3) z -> (a b c 3 e)