aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorEli Zaretskii2017-08-30 19:23:59 +0300
committerEli Zaretskii2017-08-30 19:23:59 +0300
commitb3400d82d430ccc76cb5cf5afa4f84c4635512ec (patch)
treefb67af0a0e8939ce39c4c4e0b3768ecef18cf2e2 /doc/lispref
parent9376ea3f6c736f62cc064088b2e020a9f89bae63 (diff)
downloademacs-b3400d82d430ccc76cb5cf5afa4f84c4635512ec.tar.gz
emacs-b3400d82d430ccc76cb5cf5afa4f84c4635512ec.zip
Sync NEWS with the documentation
* etc/NEWS: Mark entries according to documentation. * doc/lispref/functions.texi (Mapping Functions): Document 'mapcan'.
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/functions.texi30
1 files changed, 25 insertions, 5 deletions
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 06de2e2f730..0d407ab966b 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -930,11 +930,11 @@ the @code{call-interactively} function. @xref{Interactive Call}.
930 A @dfn{mapping function} applies a given function (@emph{not} a 930 A @dfn{mapping function} applies a given function (@emph{not} a
931special form or macro) to each element of a list or other collection. 931special form or macro) to each element of a list or other collection.
932Emacs Lisp has several such functions; this section describes 932Emacs Lisp has several such functions; this section describes
933@code{mapcar}, @code{mapc}, and @code{mapconcat}, which map over a 933@code{mapcar}, @code{mapc}, @code{mapconcat}, and @code{mapcan}, which
934list. @xref{Definition of mapatoms}, for the function @code{mapatoms} 934map over a list. @xref{Definition of mapatoms}, for the function
935which maps over the symbols in an obarray. @xref{Definition of 935@code{mapatoms} which maps over the symbols in an obarray.
936maphash}, for the function @code{maphash} which maps over key/value 936@xref{Definition of maphash}, for the function @code{maphash} which
937associations in a hash table. 937maps over key/value associations in a hash table.
938 938
939 These mapping functions do not allow char-tables because a char-table 939 These mapping functions do not allow char-tables because a char-table
940is a sparse array whose nominal range of indices is very large. To map 940is a sparse array whose nominal range of indices is very large. To map
@@ -986,6 +986,26 @@ Return the list of results."
986@end example 986@end example
987@end defun 987@end defun
988 988
989@defun mapcan function sequence
990This function applies @var{function} to each element of
991@var{sequence}, like @code{mapcar}, but instead of collecting the
992results into a list, it returns a single list with all the elements of
993the results (which must be lists), by altering the results (using
994@code{nconc}; @pxref{Rearrangement}). Like with @code{mapcar},
995@var{sequence} can be of any type except a char-table.
996
997@group
998@example
999;; @r{Contrast this:}
1000(mapcar 'list '(a b c d))
1001 @result{} ((a) (b) (c) (d))
1002;; @r{with this:}
1003(mapcan 'list '(a b c d))
1004 @result{} (a b c d)
1005@end example
1006@end group
1007@end defun
1008
989@defun mapc function sequence 1009@defun mapc function sequence
990@code{mapc} is like @code{mapcar} except that @var{function} is used for 1010@code{mapc} is like @code{mapcar} except that @var{function} is used for
991side-effects only---the values it returns are ignored, not collected 1011side-effects only---the values it returns are ignored, not collected