diff options
| author | Richard M. Stallman | 1998-08-08 23:16:07 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-08-08 23:16:07 +0000 |
| commit | a46dba07a8bf41046dcc2c3f170851edc5045f3d (patch) | |
| tree | eec7d32242a521f5f665204b77ba57ea525f09ae | |
| parent | 1fa0de2c8638c89c82f1bcf6c409fa7210ba2ef0 (diff) | |
| download | emacs-a46dba07a8bf41046dcc2c3f170851edc5045f3d.tar.gz emacs-a46dba07a8bf41046dcc2c3f170851edc5045f3d.zip | |
Describe assoc-default.
| -rw-r--r-- | lispref/lists.texi | 20 |
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 | ||
| 1443 | This function searches @var{alist} for a match for @var{key}. For each | ||
| 1444 | element of @var{alist}, it compares the element (if it is an atom) or | ||
| 1445 | the 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 | ||
| 1448 | useful results using @code{string-match} with an alist that contains | ||
| 1449 | regular expressions (@pxref{Regexp Search}). If @var{test} is omitted | ||
| 1450 | or @code{nil}, @code{equal} is used for comparison. | ||
| 1451 | |||
| 1452 | If an alist element matches @var{key} by this criterion, | ||
| 1453 | then @code{assoc-default} returns a value based on this element. | ||
| 1454 | If the element is a cons, then the value is the element's @sc{cdr}. | ||
| 1455 | Otherwise, the return value is @var{default}. | ||
| 1456 | |||
| 1457 | If 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 |
| 1443 | This function returns a two-level deep copy of @var{alist}: it creates a | 1463 | This function returns a two-level deep copy of @var{alist}: it creates a |