diff options
| author | Leo Liu | 2014-05-21 11:49:58 +0800 |
|---|---|---|
| committer | Leo Liu | 2014-05-21 11:49:58 +0800 |
| commit | 254b7645f30f67abd00b773f2b0eac63d4c382dd (patch) | |
| tree | 30b7feb81da5fb54bceb4a06f6f020fd22bb70f1 | |
| parent | e619d93c227597bccc8b3d76ee8518fb20098bb1 (diff) | |
| download | emacs-254b7645f30f67abd00b773f2b0eac63d4c382dd.tar.gz emacs-254b7645f30f67abd00b773f2b0eac63d4c382dd.zip | |
* doc/lispref/sequences.texi (Sequence Functions): Update nreverse.
* src/fns.c (Fnreverse): Accept strings for SEQ and update doc-string.
| -rw-r--r-- | doc/lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/lispref/sequences.texi | 7 | ||||
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/fns.c | 11 |
4 files changed, 18 insertions, 8 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 6de8adf1215..7d13d06b580 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2014-05-21 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * sequences.texi (Sequence Functions): Update nreverse. | ||
| 4 | |||
| 1 | 2014-05-19 Paul Eggert <eggert@cs.ucla.edu> | 5 | 2014-05-19 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 6 | ||
| 3 | Allow any non-nil value to count as true in bool-vector. | 7 | Allow any non-nil value to count as true in bool-vector. |
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 68467830a67..9b3df17ceb3 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi | |||
| @@ -261,13 +261,16 @@ x | |||
| 261 | @end defun | 261 | @end defun |
| 262 | 262 | ||
| 263 | @defun nreverse seq | 263 | @defun nreverse seq |
| 264 | @cindex reversing a string | ||
| 264 | @cindex reversing a list | 265 | @cindex reversing a list |
| 265 | @cindex reversing a vector | 266 | @cindex reversing a vector |
| 266 | This function reverses the order of the elements of @var{seq}. | 267 | This function reverses the order of the elements of @var{seq}. |
| 267 | If @var{seq} is a list, @code{nreverse} alters its by reversing the @sc{cdr}s | 268 | If @var{seq} is a list, @code{nreverse} alters it by reversing the @sc{cdr}s |
| 268 | in the cons cells. The cons cell that used to be the last one in @var{seq} | 269 | in the cons cells. The cons cell that used to be the last one in @var{seq} |
| 269 | becomes the first cons cell of the value. If @var{seq} is a vector or | 270 | becomes the first cons cell of the value. If @var{seq} is a vector or |
| 270 | bool vector, its items are placed in the same vector in a reversed order. | 271 | bool vector, its items are placed in the same vector in a reversed |
| 272 | order. If @var{seq} is a string, it works like @code{reverse} i.e., no | ||
| 273 | destructive modifcation in preference to treat strings as immutable. | ||
| 271 | 274 | ||
| 272 | For example: | 275 | For example: |
| 273 | 276 | ||
diff --git a/src/ChangeLog b/src/ChangeLog index 0ca3deaec9c..d6e21a777c2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2014-05-21 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * fns.c (Fnreverse): Accept strings for SEQ and update doc-string. | ||
| 4 | |||
| 1 | 2014-05-20 Michael Albinus <michael.albinus@gmx.de> | 5 | 2014-05-20 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 6 | ||
| 3 | * dbusbind.c (xd_signature): Revert last 2 patches. | 7 | * dbusbind.c (xd_signature): Revert last 2 patches. |
| @@ -1697,16 +1697,15 @@ changing the value of a sequence `foo'. */) | |||
| 1697 | } | 1697 | } |
| 1698 | 1698 | ||
| 1699 | DEFUN ("nreverse", Fnreverse, Snreverse, 1, 1, 0, | 1699 | DEFUN ("nreverse", Fnreverse, Snreverse, 1, 1, 0, |
| 1700 | doc: /* Reverse order of items in a list or vector SEQ. | 1700 | doc: /* Reverse order of items in a list, vector or string SEQ. |
| 1701 | If SEQ is a list, it should be nil-terminated, and reversed | 1701 | If SEQ is a list, it should be nil-terminated. |
| 1702 | by modifying cdr pointers. Return the reversed SEQ. | 1702 | This function may destructively modify SEQ to produce the value. */) |
| 1703 | |||
| 1704 | Note that unlike `reverse', this function doesn't work with strings. | ||
| 1705 | It is strongly encouraged to treat them as immutable. */) | ||
| 1706 | (Lisp_Object seq) | 1703 | (Lisp_Object seq) |
| 1707 | { | 1704 | { |
| 1708 | if (NILP (seq)) | 1705 | if (NILP (seq)) |
| 1709 | return seq; | 1706 | return seq; |
| 1707 | else if (STRINGP (seq)) | ||
| 1708 | return Freverse (seq); | ||
| 1710 | else if (CONSP (seq)) | 1709 | else if (CONSP (seq)) |
| 1711 | { | 1710 | { |
| 1712 | Lisp_Object prev, tail, next; | 1711 | Lisp_Object prev, tail, next; |