Function: mapcan
mapcan is a function defined in fns.c.
Signature
(mapcan FUNCTION SEQUENCE)
Documentation
Apply FUNCTION to each element of SEQUENCE, and concatenate
the results by altering them (using nconc).
SEQUENCE may be a list, a vector, a bool-vector, or a string.
Other relevant functions are documented in the list group.
Probably introduced at or before Emacs version 26.1.
Shortdoc
;; list
(mapcan #'list '(1 2 3))
=> (1 2 3)
Source Code
// Defined in /usr/src/emacs/src/fns.c
{
USE_SAFE_ALLOCA;
EMACS_INT leni = XFIXNAT (Flength (sequence));
if (CHAR_TABLE_P (sequence))
wrong_type_argument (Qlistp, sequence);
Lisp_Object *args;
SAFE_ALLOCA_LISP (args, leni);
ptrdiff_t nmapped = mapcar1 (leni, args, function, sequence);
Lisp_Object ret = Fnconc (nmapped, args);
SAFE_FREE ();
return ret;
}