[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117133: * doc/lispref/sequences.texi (Sequence Func

From: Leo Liu
Subject: [Emacs-diffs] trunk r117133: * doc/lispref/sequences.texi (Sequence Functions): Update nreverse.
Date: Wed, 21 May 2014 04:00:52 +0000
User-agent: Bazaar (2.6b2)

revno: 117133
revision-id: address@hidden
parent: address@hidden
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Wed 2014-05-21 11:49:58 +0800
  * doc/lispref/sequences.texi (Sequence Functions): Update nreverse.
  * src/fns.c (Fnreverse): Accept strings for SEQ and update doc-string.
  doc/lispref/ChangeLog          changelog-20091113204419-o5vbwnq5f7feedwu-6155
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/fns.c                      fns.c-20091113204419-o5vbwnq5f7feedwu-203
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2014-05-19 19:19:05 +0000
+++ b/doc/lispref/ChangeLog     2014-05-21 03:49:58 +0000
@@ -1,3 +1,7 @@
+2014-05-21  Leo Liu  <address@hidden>
+       * sequences.texi (Sequence Functions): Update nreverse.
 2014-05-19  Paul Eggert  <address@hidden>
        Allow any non-nil value to count as true in bool-vector.

=== modified file 'doc/lispref/sequences.texi'
--- a/doc/lispref/sequences.texi        2014-05-19 19:19:05 +0000
+++ b/doc/lispref/sequences.texi        2014-05-21 03:49:58 +0000
@@ -261,13 +261,16 @@
 @end defun
 @defun nreverse seq
address@hidden reversing a string
 @cindex reversing a list
 @cindex reversing a vector
   This function reverses the order of the elements of @var{seq}.
-If @var{seq} is a list, @code{nreverse} alters its by reversing the @sc{cdr}s
+If @var{seq} is a list, @code{nreverse} alters it by reversing the @sc{cdr}s
 in the cons cells.  The cons cell that used to be the last one in @var{seq}
 becomes the first cons cell of the value.  If @var{seq} is a vector or
-bool vector, its items are placed in the same vector in a reversed order.
+bool vector, its items are placed in the same vector in a reversed
+order.  If @var{seq} is a string, it works like @code{reverse} i.e., no
+destructive modifcation in preference to treat strings as immutable.
   For example:

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-05-20 08:25:18 +0000
+++ b/src/ChangeLog     2014-05-21 03:49:58 +0000
@@ -1,3 +1,7 @@
+2014-05-21  Leo Liu  <address@hidden>
+       * fns.c (Fnreverse): Accept strings for SEQ and update doc-string.
 2014-05-20  Michael Albinus  <address@hidden>
        * dbusbind.c (xd_signature): Revert last 2 patches.

=== modified file 'src/fns.c'
--- a/src/fns.c 2014-05-15 14:59:02 +0000
+++ b/src/fns.c 2014-05-21 03:49:58 +0000
@@ -1697,16 +1697,15 @@
 DEFUN ("nreverse", Fnreverse, Snreverse, 1, 1, 0,
-       doc: /* Reverse order of items in a list or vector SEQ.
-If SEQ is a list, it should be nil-terminated, and reversed
-by modifying cdr pointers.  Return the reversed SEQ.
-Note that unlike `reverse', this function doesn't work with strings.
-It is strongly encouraged to treat them as immutable.  */)
+       doc: /* Reverse order of items in a list, vector or string SEQ.
+If SEQ is a list, it should be nil-terminated.
+This function may destructively modify SEQ to produce the value.  */)
   (Lisp_Object seq)
   if (NILP (seq))
     return seq;
+  else if (STRINGP (seq))
+    return Freverse (seq);
   else if (CONSP (seq))
       Lisp_Object prev, tail, next;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]