The 'rplacd' function destructively modifies the cdr of 'list' and replaces it with the 'expr'. The destructive aspect of this operation means that the actual symbol value is used in the list-modifying operations, not a copy. 'list' must evaluate to a valid list.
An atom or NIL for 'list' will result in an error:
error: bad argument type
(setq a '(1 2 3)) ; set up A with (1 2 3) (rplacd a 'new) ; returns (1 . NEW) (print a) ; prints (1 . NEW) ; note that A is modified (rplacd a '(a new list)) ; returns (1 A NEW LIST) (rplacd '(1 2 3) '(more)) ; returns (1 MORE) (rplacd 'a 'b) ; error: bad argument type (rplacd NIL 'b) ; error: bad argument type
See the
rplacd
function in the