Node:List Modification, Next:, Previous:Append/Reverse, Up:Lists



22.2.6 List Modification

The following procedures modify an existing list, either by changing elements of the list, or by changing the list structure itself.

list-set! list k val Scheme Procedure
scm_list_set_x (list, k, val) C Function
Set the kth element of list to val.

list-cdr-set! list k val Scheme Procedure
scm_list_cdr_set_x (list, k, val) C Function
Set the kth cdr of list to val.

delq item lst Scheme Procedure
scm_delq (item, lst) C Function
Return a newly-created copy of lst with elements eq? to item removed. This procedure mirrors memq: delq compares elements of lst against item with eq?.

delv item lst Scheme Procedure
scm_delv (item, lst) C Function
Return a newly-created copy of lst with elements eqv? to item removed. This procedure mirrors memv: delv compares elements of lst against item with eqv?.

delete item lst Scheme Procedure
scm_delete (item, lst) C Function
Return a newly-created copy of lst with elements equal? to item removed. This procedure mirrors member: delete compares elements of lst against item with equal?.

delq! item lst Scheme Procedure
delv! item lst Scheme Procedure
delete! item lst Scheme Procedure
scm_delq_x (item, lst) C Function
scm_delv_x (item, lst) C Function
scm_delete_x (item, lst) C Function
These procedures are destructive versions of delq, delv and delete: they modify the pointers in the existing lst rather than creating a new list. Caveat evaluator: Like other destructive list functions, these functions cannot modify the binding of lst, and so cannot be used to delete the first element of lst destructively.

delq1! item lst Scheme Procedure
scm_delq1_x (item, lst) C Function
Like delq!, but only deletes the first occurrence of item from lst. Tests for equality using eq?. See also delv1! and delete1!.

delv1! item lst Scheme Procedure
scm_delv1_x (item, lst) C Function
Like delv!, but only deletes the first occurrence of item from lst. Tests for equality using eqv?. See also delq1! and delete1!.

delete1! item lst Scheme Procedure
scm_delete1_x (item, lst) C Function
Like delete!, but only deletes the first occurrence of item from lst. Tests for equality using equal?. See also delq1! and delv1!.