]> code.delx.au - gnu-emacs/blobdiff - doc/lispref/lists.texi
(Common Keywords): Correct what missing :group means
[gnu-emacs] / doc / lispref / lists.texi
index 21be5cca4fcd4026880a66a54e281ff361ecfee5..c18c408209a3b24369cf4fbb4cc503c2e5135f15 100644 (file)
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990-1995, 1998-1999, 2001-2014 Free Software
+@c Copyright (C) 1990-1995, 1998-1999, 2001-2016 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Lists
@@ -41,7 +41,7 @@ pronounced ``could-er''.
   We say that ``the @sc{car} of this cons cell is'' whatever object
 its @sc{car} slot currently holds, and likewise for the @sc{cdr}.
 
-  A list is a series of cons cells ``chained together'', so that each
+  A list is a series of cons cells chained together, so that each
 cell refers to the next one.  There is one cons cell for each element
 of the list.  By convention, the @sc{car}s of the cons cells hold the
 elements of the list, and the @sc{cdr}s are used to chain the list
@@ -84,6 +84,8 @@ structure made out of cons cells as a @dfn{list structure}.
 
 @node List-related Predicates
 @section Predicates on Lists
+@cindex predicates for lists
+@cindex list predicates
 
   The following predicates test whether a Lisp object is an atom,
 whether it is a cons cell or is a list, or whether it is the
@@ -662,6 +664,8 @@ Some examples:
 
 @node List Variables
 @section Modifying List Variables
+@cindex modify a list
+@cindex list modification
 
   These functions, and one macro, provide convenient ways
 to modify a list which is stored in a variable.
@@ -795,7 +799,7 @@ foo                       ;; @r{@code{foo} was changed.}
 @cindex destructive list operations
 
   You can modify the @sc{car} and @sc{cdr} contents of a cons cell with the
-primitives @code{setcar} and @code{setcdr}.  We call these ``destructive''
+primitives @code{setcar} and @code{setcdr}.  These are destructive
 operations because they change existing list structure.
 
 @cindex CL note---@code{rplaca} vs @code{setcar}
@@ -818,6 +822,8 @@ new @sc{car} or @sc{cdr}.
 
 @node Setcar
 @subsection Altering List Elements with @code{setcar}
+@cindex replace list element
+@cindex list, replace element
 
   Changing the @sc{car} of a cons cell is done with @code{setcar}.  When
 used on a list, @code{setcar} replaces one element of a list with a
@@ -923,6 +929,7 @@ x2:              |
 
 @node Setcdr
 @subsection Altering the CDR of a List
+@cindex replace part of list
 
   The lowest-level primitive for modifying a @sc{cdr} is @code{setcdr}:
 
@@ -1028,9 +1035,9 @@ x1
 @cindex reordering, of elements in lists
 @cindex modification of lists
 
-  Here are some functions that rearrange lists ``destructively'' by
-modifying the @sc{cdr}s of their component cons cells.  We call these
-functions ``destructive'' because they chew up the original lists passed
+  Here are some functions that rearrange lists destructively by
+modifying the @sc{cdr}s of their component cons cells.  These functions
+are destructive because they chew up the original lists passed
 to them as arguments, relinking their cons cells to form a new list that
 is the returned value.
 
@@ -1515,7 +1522,7 @@ a @sc{cdr} @code{equal} to @var{value}.
 
 @code{rassoc} is like @code{assoc} except that it compares the @sc{cdr} of
 each @var{alist} association instead of the @sc{car}.  You can think of
-this as ``reverse @code{assoc}'', finding the key for a given value.
+this as reverse @code{assoc}, finding the key for a given value.
 @end defun
 
 @defun assq key alist
@@ -1549,6 +1556,14 @@ keys may not be symbols:
 @end smallexample
 @end defun
 
+@defun alist-get key value &optional default
+This function is like @code{assq}, but instead of returning the entire
+association for @var{key}, @code{(@var{key} . @var{value})}, it
+returns just the @var{value}.  It returns @var{default} if @var{key}
+is not found in @var{alist}, defaulting to @code{nil} if @var{default}
+is omitted.
+@end defun
+
 @defun rassq value alist
 This function returns the first association with value @var{value} in
 @var{alist}.  It returns @code{nil} if no association in @var{alist} has
@@ -1556,7 +1571,7 @@ a @sc{cdr} @code{eq} to @var{value}.
 
 @code{rassq} is like @code{assq} except that it compares the @sc{cdr} of
 each @var{alist} association instead of the @sc{car}.  You can think of
-this as ``reverse @code{assq}'', finding the key for a given value.
+this as reverse @code{assq}, finding the key for a given value.
 
 For example:
 
@@ -1759,6 +1774,8 @@ and later discarded; this is not possible with a property list.
 
 @node Plist Access
 @subsection Property Lists Outside Symbols
+@cindex plist access
+@cindex accessing plist properties
 
   The following functions can be used to manipulate property lists.
 They all compare property names using @code{eq}.