From 0ad04acf5890bdeccb645bd403f3a63713e57f0d Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Fri, 19 May 2006 23:30:15 +0000 Subject: [PATCH] (SRFI-1 Association Lists): Describe argument order for "=" procedure. --- doc/ref/srfi-modules.texi | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/ref/srfi-modules.texi b/doc/ref/srfi-modules.texi index 3291320f3..f749e64d8 100644 --- a/doc/ref/srfi-modules.texi +++ b/doc/ref/srfi-modules.texi @@ -937,12 +937,21 @@ Lists}. The present section only documents the additional procedures for dealing with association lists defined by SRFI-1. @deffn {Scheme Procedure} assoc key alist [=] -Return the pair from @var{alist} which matches @var{key}. Equality is -determined by @var{=}, which defaults to @code{equal?} if not given. -@var{alist} must be an association lists---a list of pairs. +Return the pair from @var{alist} which matches @var{key}. This +extends the core @code{assoc} (@pxref{Retrieving Alist Entries}) by +taking an optional @var{=} comparison procedure. -This function extends the core @code{assoc} by accepting an equality -predicate. (@pxref{Association Lists}) +The default comparison is @code{equal?}. If an @var{=} parameter is +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 @deffn {Scheme Procedure} alist-cons key datum alist