rplaca, rplacd
rplaca, rplacd — replace the car and cdr of a list.
rplaca (cons, s_exp)
rplacd (cons, s_exp)
listA list element.
s_expAny Gamma or Lisp expression.
The s_exp, or nil on failure.
These functions destructively alter the form of a list.
rplaca modifies the car of a list, effectively
replacing the first element. rplacd modifies the cdr of
a list, replacing the entire tail of the list. These functions have no
meaning for non-lists. To entirely remove the tail of a list, replace the
cdr of the list with nil.
Gamma>x = list(1,2,3,4);(1 2 3 4)Gamma>rplaca(x,0);0Gamma>x;(0 2 3 4)Gamma>rplacd(x,list(7,8,9,10,11,12));(7 8 9 10 11 12)Gamma>x;(0 7 8 9 10 11 12)Gamma>