mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-23 13:00:34 +02:00
(SRFI-1 Association Lists): Describe argument order for "=" procedure.
This commit is contained in:
parent
9d7b09897b
commit
0ad04acf58
1 changed files with 14 additions and 5 deletions
|
@ -937,12 +937,21 @@ Lists}. The present section only documents the additional procedures
|
||||||
for dealing with association lists defined by SRFI-1.
|
for dealing with association lists defined by SRFI-1.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} assoc key alist [=]
|
@deffn {Scheme Procedure} assoc key alist [=]
|
||||||
Return the pair from @var{alist} which matches @var{key}. Equality is
|
Return the pair from @var{alist} which matches @var{key}. This
|
||||||
determined by @var{=}, which defaults to @code{equal?} if not given.
|
extends the core @code{assoc} (@pxref{Retrieving Alist Entries}) by
|
||||||
@var{alist} must be an association lists---a list of pairs.
|
taking an optional @var{=} comparison procedure.
|
||||||
|
|
||||||
This function extends the core @code{assoc} by accepting an equality
|
The default comparison is @code{equal?}. If an @var{=} parameter is
|
||||||
predicate. (@pxref{Association Lists})
|
given it's called @code{(@var{=} @var{key} @var{alistcar})}, ie. the
|
||||||
|
given target @var{key} is the first argument, and a @code{car} from
|
||||||
|
@var{alist} is second.
|
||||||
|
|
||||||
|
For example a case-insensitive string lookup,
|
||||||
|
|
||||||
|
@example
|
||||||
|
(assoc "yy" '(("XX" . 1) ("YY" . 2)) string-ci=?)
|
||||||
|
@result{} ("YY" . 2)
|
||||||
|
@end example
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} alist-cons key datum alist
|
@deffn {Scheme Procedure} alist-cons key datum alist
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue