summaryrefslogtreecommitdiff
path: root/doc/lispref/sequences.texi
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2014-05-15 10:01:46 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2014-05-15 10:01:46 +0400
commitc269148bf9a039edff92b1dd7a415d30c21d3087 (patch)
tree00a599d3a6b51ddceb51faddce5ef704c6a74e3e /doc/lispref/sequences.texi
parentb8e11d4102870e70dc50796454fcdae658caadbb (diff)
downloademacs-c269148bf9a039edff92b1dd7a415d30c21d3087.tar.gz
* src/fns.c (Freverse): Allow vectors, bool vectors and strings.
* doc/lispref/lists.texi (Building Cons Cells and Lists): Remove description of `reverse' and generalize it... * doc/lispref/sequences.texi (Sequences): ...for sequences here.
Diffstat (limited to 'doc/lispref/sequences.texi')
-rw-r--r--doc/lispref/sequences.texi43
1 files changed, 43 insertions, 0 deletions
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index 01de4ccb0cd..c96f1222f3f 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -217,6 +217,49 @@ y @result{} [foo (69 2)]
@end example
@end defun
+@defun reverse seq
+@cindex string reverse
+@cindex list reverse
+@cindex vector reverse
+@cindex sequence reverse
+This function creates a new sequence whose elements are the elements
+of @var{seq}, but in reverse order. The original argument @var{seq}
+is @emph{not} altered. Note that char-table cannot be reversed.
+
+@example
+@group
+(setq x '(1 2 3 4))
+ @result{} (1 2 3 4)
+@end group
+@group
+(reverse x)
+ @result{} (4 3 2 1)
+x
+ @result{} (1 2 3 4)
+@end group
+@group
+(setq x [1 2 3 4])
+ @result{} [1 2 3 4]
+@end group
+@group
+(reverse x)
+ @result{} [4 3 2 1]
+x
+ @result{} [1 2 3 4]
+@end group
+@group
+(setq x "xyzzy")
+ @result{} "xyzzy"
+@end group
+@group
+(reverse x)
+ @result{} "yzzyx"
+x
+ @result{} "xyzzy"
+@end group
+@end example
+@end defun
+
@node Arrays
@section Arrays
@cindex array