summaryrefslogtreecommitdiff
path: root/lispref/lists.texi
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-05-19 03:45:57 +0000
committerRichard M. Stallman <rms@gnu.org>1998-05-19 03:45:57 +0000
commita9f0a989a17f47f9d25b7a426b4e82a8ff684ee4 (patch)
treed62b5592064177c684f1509989b223623db3f24c /lispref/lists.texi
parentc6d6572475603083762cb0155ae966de7710bb9c (diff)
downloademacs-a9f0a989a17f47f9d25b7a426b4e82a8ff684ee4.tar.gz
*** empty log message ***
Diffstat (limited to 'lispref/lists.texi')
-rw-r--r--lispref/lists.texi27
1 files changed, 20 insertions, 7 deletions
diff --git a/lispref/lists.texi b/lispref/lists.texi
index 3f269dc9093..bdc94dc015a 100644
--- a/lispref/lists.texi
+++ b/lispref/lists.texi
@@ -357,8 +357,8 @@ If @var{n} is zero or negative, @code{nthcdr} returns all of
@end example
@end defun
-@tindex safe-length
@defun safe-length list
+@tindex safe-length
This function returns the length of @var{list}, with no risk
of either an error or an infinite loop.
@@ -371,24 +371,24 @@ number of distinct elements.
worried that it may be circular, is with @code{length}. @xref{Sequence
Functions}.
-@tindex caar
@defun caar cons-cell
+@tindex caar
This is the same as @code{(car (car @var{cons-cell}))}.
@end defun
-@tindex cadr
@defun cadr cons-cell
+@tindex cadr
This is the same as @code{(car (cdr @var{cons-cell}))}
or @code{(nth 1 @var{cons-cell})}.
@end defun
-@tindex cdar
@defun cdar cons-cell
+@tindex cdar
This is the same as @code{(cdr (car @var{cons-cell}))}.
@end defun
-@tindex cddr
@defun cddr cons-cell
+@tindex cddr
This is the same as @code{(cdr (cdr @var{cons-cell}))}
or @code{(nthcdr 2 @var{cons-cell})}.
@end defun
@@ -572,8 +572,8 @@ Here we show the use of vectors and strings as arguments to @code{append}:
@end group
@end example
-With the help of @code{apply}, we can append all the lists in a list of
-lists:
+With the help of @code{apply} (@pxref{Calling Functions}), we can append
+all the lists in a list of lists:
@example
@group
@@ -1030,6 +1030,15 @@ arguments. It is called with two elements of @var{list}. To get an
increasing order sort, the @var{predicate} should return @code{t} if the
first element is ``less than'' the second, or @code{nil} if not.
+The comparison function @var{predicate} must give reliable results for
+any given pair of arguments, at least within a single call to
+@code{sort}. It must be @dfn{antisymmetric}; that is, if @var{a} is
+less than @var{b}, @var{b} must not be less than @var{a}. It must be
+@dfn{transitive}---that is, if @var{a} is less than @var{b}, and @var{b}
+is less than @var{c}, then @var{a} must be less than @var{c}. If you
+use a comparison function which does not meet these requirements, the
+result of @code{sort} is unpredictable.
+
The destructive aspect of @code{sort} is that it rearranges the cons
cells forming @var{list} by changing @sc{cdr}s. A nondestructive sort
function would create new cons cells to store the elements in their
@@ -1338,6 +1347,10 @@ Here is another example, in which the keys and values are not symbols:
@end smallexample
@end defun
+ The functions @code{assoc-ignore-representation} and
+@code{assoc-ignore-case} are much like @code{assoc} except using
+@code{compare-strings} to do the comparison. @xref{Text Comparison}.
+
@defun rassoc 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