mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 22:10:21 +02:00
(SRFI-1 Association Lists): In alist-delete and
alist-delete!, note argument order for the equality calls per SRFI-1 spec.
This commit is contained in:
parent
d61d8580a5
commit
bd35f1f07c
1 changed files with 13 additions and 5 deletions
|
@ -774,12 +774,20 @@ spine of the list as well as the pairs are copied.
|
|||
|
||||
@deffn {Scheme Procedure} alist-delete key alist [=]
|
||||
@deffnx {Scheme Procedure} alist-delete! key alist [=]
|
||||
Return a list containing the pairs of @var{alist}, but without the
|
||||
pairs whose @sc{cars} are equal to @var{key}. Equality is determined
|
||||
by @var{=}, which defaults to @code{equal?} if not given.
|
||||
Return a list containing the elements of @var{alist} but with those
|
||||
elements whose keys are equal to @var{key} deleted. The returned
|
||||
elements will be in the same order as they were in @var{alist}.
|
||||
|
||||
@code{alist-delete!} is allowed, but not required to modify the
|
||||
structure of the list @var{alist} in order to produce the result.
|
||||
Equality is determined by the @var{=} predicate, or @code{equal?} if
|
||||
not given. The order in which elements are tested is unspecified, but
|
||||
each equality call is made @code{(= key alistkey)}, ie. the given
|
||||
@var{key} parameter is first and the key from @var{alist} second.
|
||||
This means for instance all associations with a key greater than 5 can
|
||||
be removed with @code{(alist-delete 5 alist <)}.
|
||||
|
||||
@code{alist-delete} does not modify @var{alist}, but the return might
|
||||
share a common tail with @var{alist}. @code{alist-delete!} may modify
|
||||
the list structure of @var{alist} to construct its return.
|
||||
@end deffn
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue