1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 16:51:06 -07:00

Make 'mapconcat' argument 'separator' optional

* src/fns.c (Fmapconcat): Make third 'separator' argument
optional.  (Bug#50965)
* doc/lispref/functions.texi (Mapping Functions): Update
documentation for above change.
* test/src/fns-tests.el (fns-tests-mapconcat): New test.

* doc/misc/cl.texi (Obsolete Setf Customization): Don't use third
mapconcat argument in example.
* lisp/emacs-lisp/subr-x.el (string-join): Doc fix.
This commit is contained in:
Stefan Kangas 2021-10-05 15:36:31 +02:00
parent 4bf532ee82
commit d652efcd08
6 changed files with 35 additions and 9 deletions

View file

@ -961,14 +961,14 @@ side-effects only---the values it returns are ignored, not collected
into a list. @code{mapc} always returns @var{sequence}.
@end defun
@defun mapconcat function sequence separator
@defun mapconcat function sequence &optional separator
@code{mapconcat} applies @var{function} to each element of
@var{sequence}; the results, which must be sequences of characters
(strings, vectors, or lists), are concatenated into a single string
return value. Between each pair of result sequences, @code{mapconcat}
inserts the characters from @var{separator}, which also must be a
string, or a vector or list of characters. @xref{Sequences Arrays
Vectors}.
string, or a vector or list of characters; a @code{nil} value is
treated as the empty string. @xref{Sequences Arrays Vectors}.
The argument @var{function} must be a function that can take one
argument and returns a sequence of characters: a string, a vector, or
@ -986,8 +986,7 @@ string.
@group
(mapconcat (lambda (x) (format "%c" (1+ x)))
"HAL-8000"
"")
"HAL-8000")
@result{} "IBM.9111"
@end group
@end example

View file

@ -5030,7 +5030,7 @@ The above @code{incf} example could be written using
@ignore
(defmacro concatf (place &rest args)
(gv-letplace (getter setter) place
(macroexp-let2 nil v (mapconcat 'identity args "")
(macroexp-let2 nil v (mapconcat 'identity args)
(funcall setter `(concat ,getter ,v)))))
@end ignore
@end defmac