Next: , Previous: , Up: Mapping Functions   [Index]


F.2.3.2 Function mapcan

This function applies ‘FUNCTION’ to each element of ‘SEQUENCE’, like mapcar, but instead of collecting the results into a list, it returns a single list with all the elements of the results (which must be lists), by altering the results (using nconc).

Function: mapcan

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.

Example of mapcan

; Contrast this:
(mapcar 'list '(a b c d))
     ⇒ ((a) (b) (c) (d))
;; with this:
(mapcan 'list '(a b c d))
     ⇒ (a b c d)