summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-08-18 22:07:30 +0300
committerEli Zaretskii <eliz@gnu.org>2021-08-18 22:07:30 +0300
commit78b427648b85d0f7e93ad5f18537ad9f2da055cb (patch)
tree9b7f8f95c185da0b1c1d009a3c92145ec32a6014 /doc
parent91f549becd03b1598b9d8b233f6058ba027f0a84 (diff)
downloademacs-78b427648b85d0f7e93ad5f18537ad9f2da055cb.tar.gz
Improve documentation of 'assoc'
* doc/lispref/lists.texi (Association Lists): * src/fns.c (Fassoc): Document how TESTFN is called. (Bug#50110)
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/lists.texi10
1 files changed, 6 insertions, 4 deletions
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index ac99835f7b3..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)))