You can modify the CAR and CDR contents of a cons cell with the primitives
setcdr. These are destructive operations because they change existing list structure. Destructive operations should be applied only to mutable lists, that is, lists constructed via
list or similar operations. Lists created by quoting are part of the program and should not be changed by destructive operations. See Mutability.
Common Lisp note: Common Lisp uses functions
rplacdto alter list structure; they change structure the same way as
setcdr, but the Common Lisp functions return the cons cell while
setcdrreturn 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.|
Copyright © 1990-1996, 1998-2019 Free Software Foundation, Inc.
Licensed under the GNU GPL license.