aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorEli Zaretskii2024-09-23 14:41:34 +0300
committerEli Zaretskii2024-09-23 14:41:34 +0300
commitc8ed48b9901790fdabcf91ef15a6ba47c96b48c8 (patch)
tree846c960b3dd5d648768ca5efe4641314ff835318 /doc
parentc1f2501f55d7454222389244512f732ac5e778b4 (diff)
downloademacs-c8ed48b9901790fdabcf91ef15a6ba47c96b48c8.tar.gz
emacs-c8ed48b9901790fdabcf91ef15a6ba47c96b48c8.zip
; Improve documentation of 'append'
* doc/lispref/lists.texi (Building Lists): * src/fns.c (Fappend): Improve documentation of 'append'. (Bug#73427)
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/lists.texi24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 6f4d838042a..816af4a4ff7 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -668,6 +668,17 @@ This once was the usual way to copy a list, before the function
668@end group 668@end group
669@end example 669@end example
670 670
671@cindex list of characters of a string
672@cindex convert string to list of its characters
673 Here's how to convert a string into a list of its characters:
674
675@example
676@group
677(append "abcd" nil)
678 @result{} (97 98 99 100)
679@end group
680@end example
681
671 With the help of @code{apply} (@pxref{Calling Functions}), we can append 682 With the help of @code{apply} (@pxref{Calling Functions}), we can append
672all the lists in a list of lists: 683all the lists in a list of lists:
673 684
@@ -690,10 +701,12 @@ all the lists in a list of lists:
690 Here are some examples where the final argument is not a list: 701 Here are some examples where the final argument is not a list:
691 702
692@example 703@example
704@group
693(append '(x y) 'z) 705(append '(x y) 'z)
694 @result{} (x y . z) 706 @result{} (x y . z)
695(append '(x y) [z]) 707(append '(x y) [z])
696 @result{} (x y . [z]) 708 @result{} (x y . [z])
709@end group
697@end example 710@end example
698 711
699@noindent 712@noindent
@@ -702,6 +715,17 @@ not a list, the sequence's elements do not become elements of the
702resulting list. Instead, the sequence becomes the final @sc{cdr}, like 715resulting list. Instead, the sequence becomes the final @sc{cdr}, like
703any other non-list final argument. 716any other non-list final argument.
704 717
718 As an exception, if all the arguments but the last are @code{nil} and
719the last argument is not a list, the return value is that last argument
720unchanged:
721
722@example
723@group
724(append nil nil "abcd")
725 @result{} "abcd"
726@end group
727@end example
728
705@defun copy-tree tree &optional vectors-and-records 729@defun copy-tree tree &optional vectors-and-records
706This function returns a copy of the tree @var{tree}. If @var{tree} is a 730This function returns a copy of the tree @var{tree}. If @var{tree} is a
707cons cell, this makes a new cons cell with the same @sc{car} and 731cons cell, this makes a new cons cell with the same @sc{car} and