Next: Sets And Lists, Previous: List Variables, Up: Lists [Contents][Index]
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 functions
rplacaandrplacdto alter list structure; they change structure the same way assetcarandsetcdr, but the Common Lisp functions return the cons cell whilesetcarandsetcdrreturn the new CAR or CDR.
| • Setcar: | Replacing an element in a list. | |
| • Setcdr: | Replacing part of the list backbone. This can be used to remove or add elements. | |
| • Rearrangement: | Reordering the elements in a list; combining lists. |