aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-08-08 23:16:07 +0000
committerRichard M. Stallman1998-08-08 23:16:07 +0000
commita46dba07a8bf41046dcc2c3f170851edc5045f3d (patch)
treeeec7d32242a521f5f665204b77ba57ea525f09ae
parent1fa0de2c8638c89c82f1bcf6c409fa7210ba2ef0 (diff)
downloademacs-a46dba07a8bf41046dcc2c3f170851edc5045f3d.tar.gz
emacs-a46dba07a8bf41046dcc2c3f170851edc5045f3d.zip
Describe assoc-default.
-rw-r--r--lispref/lists.texi20
1 files changed, 20 insertions, 0 deletions
diff --git a/lispref/lists.texi b/lispref/lists.texi
index 2cb7ab92adf..55dee3c22ae 100644
--- a/lispref/lists.texi
+++ b/lispref/lists.texi
@@ -1438,6 +1438,26 @@ becomes clearer if the association is written in dotted pair notation:
1438@end smallexample 1438@end smallexample
1439@end defun 1439@end defun
1440 1440
1441@tindex assoc-default
1442@defun assoc-default key alist test default
1443This function searches @var{alist} for a match for @var{key}. For each
1444element of @var{alist}, it compares the element (if it is an atom) or
1445the element's @sc{car} (if it is a cons) against @var{key}, by calling
1446@var{test} with two arguments: the element or its @sc{car}, and
1447@var{key}. The arguments are passed in that order so that you can get
1448useful results using @code{string-match} with an alist that contains
1449regular expressions (@pxref{Regexp Search}). If @var{test} is omitted
1450or @code{nil}, @code{equal} is used for comparison.
1451
1452If an alist element matches @var{key} by this criterion,
1453then @code{assoc-default} returns a value based on this element.
1454If the element is a cons, then the value is the element's @sc{cdr}.
1455Otherwise, the return value is @var{default}.
1456
1457If no alist element matches @var{key}, @code{assoc-default} returns
1458@code{nil}.
1459@end defun
1460
1441@defun copy-alist alist 1461@defun copy-alist alist
1442@cindex copying alists 1462@cindex copying alists
1443This function returns a two-level deep copy of @var{alist}: it creates a 1463This function returns a two-level deep copy of @var{alist}: it creates a