Mercurial > hg > xemacs-beta
diff man/lispref/lists.texi @ 5300:9f738305f80f
Accept sequences generally, not just lists, #'reverse, #'nreverse.
src/ChangeLog addition:
2010-11-06 Aidan Kehoe <kehoea@parhasard.net>
* bytecode.c (bytecode_nreverse): Call Fnreverse() if SEQUENCE is
not a cons in this function.
(Fnreverse, Freverse):
Accept sequences, not just lists, in these functions.
man/ChangeLog addition:
2010-11-06 Aidan Kehoe <kehoea@parhasard.net>
* lispref/lists.texi (Rearrangement, Building Lists):
Document that #'nreverse and #'reverse now accept sequences, not
just lists, in this file.
tests/ChangeLog addition:
2010-11-06 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el (list-nreverse):
Check that #'reverse and #'nreverse handle non-list sequences
properly.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 06 Nov 2010 21:18:52 +0000 |
parents | 2e528066e2fc |
children | f5a5501814f5 |
line wrap: on
line diff
--- a/man/lispref/lists.texi Sat Nov 06 14:51:13 2010 +0000 +++ b/man/lispref/lists.texi Sat Nov 06 21:18:52 2010 +0000 @@ -655,9 +655,9 @@ (@pxref{String Conversion}). @end defun -@defun reverse list -This function creates a new list whose elements are the elements of -@var{list}, but in reverse order. The original argument @var{list} is +@defun reverse sequence +This function creates a new sequence whose elements are the elements of +@var{sequence}, but in reverse order. The original argument @var{sequence} is @emph{not} altered. @example @@ -998,13 +998,14 @@ @end smallexample @end defun -@defun nreverse list +@defun nreverse sequence @cindex reversing a list - This function reverses the order of the elements of @var{list}. -Unlike @code{reverse}, @code{nreverse} alters its argument by reversing -the @sc{cdr}s in the cons cells forming the list. The cons cell that -used to be the last one in @var{list} becomes the first cell of the -value. +@cindex reversing a sequence + This function reverses the order of the elements of @var{sequence}. +Unlike @code{reverse}, @code{nreverse} alters its argument. If +@var{sequence} is a list, it does this by reversing the @sc{cdr}s in the +cons cells forming the sequence. The cons cell that used to be the last +one in @var{sequence} becomes the first cell of the value. For example: @@ -1027,7 +1028,7 @@ @end example To avoid confusion, we usually store the result of @code{nreverse} -back in the same variable which held the original list: +back in the same variable which held the original sequence: @example (setq x (nreverse x))