summaryrefslogtreecommitdiff
path: root/doc/lispref/lists.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lispref/lists.texi')
-rw-r--r--doc/lispref/lists.texi14
1 files changed, 8 insertions, 6 deletions
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 2805b1f5fdc..bbe1dce42d8 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -1557,10 +1557,12 @@ of property lists and association lists.
@defun assoc key alist &optional testfn
This function returns the first association for @var{key} in
@var{alist}, comparing @var{key} against the alist elements using
-@var{testfn} if it is non-@code{nil} and @code{equal} otherwise
-(@pxref{Equality Predicates}). It returns @code{nil} if no
-association in @var{alist} has a @sc{car} equal to @var{key}. For
-example:
+@var{testfn} if it is a function, and @code{equal} otherwise
+(@pxref{Equality Predicates}). If @var{testfn} is a function, it is
+called with two arguments: the @sc{car} of an element from @var{alist}
+and @var{key}. The function returns @code{nil} if no
+association in @var{alist} has a @sc{car} equal to @var{key}, as
+tested by @var{testfn}. For example:
@smallexample
(setq trees '((pine . cones) (oak . acorns) (maple . seeds)))
@@ -1804,7 +1806,7 @@ through a simple example:
(let-alist colors
(if (eq .rose 'red)
.lily))
-=> white
+ @result{} white
@end lisp
The @var{body} is inspected at compilation time, and only the symbols
@@ -1820,7 +1822,7 @@ Nested association lists is supported:
(let-alist colors
(if (eq .rose 'red)
.lily.belladonna))
-=> yellow
+ @result{} yellow
@end lisp
Nesting @code{let-alist} inside each other is allowed, but the code in