[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.7.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.
- Scheme Procedure: list-set! list k val
- C Function: scm_list_set_x (list, k, val)
Set the kth element of list to val.
- Scheme Procedure: list-cdr-set! list k val
- C Function: scm_list_cdr_set_x (list, k, val)
Set the kth cdr of list to val.
- Scheme Procedure: delq item lst
- C Function: scm_delq (item, lst)
Return a newly-created copy of lst with elements
eq?
to item removed. This procedure mirrorsmemq
:delq
compares elements of lst against item witheq?
.
- Scheme Procedure: delv item lst
- C Function: scm_delv (item, lst)
Return a newly-created copy of lst with elements
eqv?
to item removed. This procedure mirrorsmemv
:delv
compares elements of lst against item witheqv?
.
- Scheme Procedure: delete item lst
- C Function: scm_delete (item, lst)
Return a newly-created copy of lst with elements
equal?
to item removed. This procedure mirrorsmember
:delete
compares elements of lst against item withequal?
.See also SRFI-1 which has an extended
delete
(Deleting), and also anlset-difference
which can delete multiple items in one call (Set Operations on Lists).
- Scheme Procedure: delq! item lst
- Scheme Procedure: delv! item lst
- Scheme Procedure: delete! item lst
- C Function: scm_delq_x (item, lst)
- C Function: scm_delv_x (item, lst)
- C Function: scm_delete_x (item, lst)
These procedures are destructive versions of
delq
,delv
anddelete
: 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.
- Scheme Procedure: delq1! item lst
- C Function: scm_delq1_x (item, lst)
Like
delq!
, but only deletes the first occurrence of item from lst. Tests for equality usingeq?
. See alsodelv1!
anddelete1!
.
- Scheme Procedure: delv1! item lst
- C Function: scm_delv1_x (item, lst)
Like
delv!
, but only deletes the first occurrence of item from lst. Tests for equality usingeqv?
. See alsodelq1!
anddelete1!
.
- Scheme Procedure: delete1! item lst
- C Function: scm_delete1_x (item, lst)
Like
delete!
, but only deletes the first occurrence of item from lst. Tests for equality usingequal?
. See alsodelq1!
anddelv1!
.
- Scheme Procedure: filter pred lst
- Scheme Procedure: filter! pred lst
Return a list containing all elements from lst which satisfy the predicate pred. The elements in the result list have the same order as in lst. The order in which pred is applied to the list elements is not specified.
filter
does not change lst, but the result may share a tail with it.filter!
may modify lst to construct its return.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 20, 2013 using texi2html 5.0.