Next: Sets And Lists, Previous: List Variables, Up: Lists
You can modify the car and cdr contents of a cons cell with the
primitives setcar
and setcdr
. These are destructive
operations because they change existing list structure.
Common Lisp note: Common Lisp uses functionsrplaca
andrplacd
to alter list structure; they change structure the same way assetcar
andsetcdr
, but the Common Lisp functions return the cons cell whilesetcar
andsetcdr
return the new car or cdr.