Previous: , Up: Mapping Functions   [Index]


F.2.3.3 Function mapconcat

mapconcat applies ‘FUNCTION’ to each element of 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, mapconcat inserts the characters from ‘SEPARATOR’, which also must be a string, or a vector or list of characters.

Function: mapconcat sequence separator

Apply ‘FUNCTION’ to each element of ‘SEQUENCE’, and concat the results as strings. ‘SEQUENCE’ may be a list, a vector, a bool-vector, or a string.

In between each pair of results, stick in ‘SEPARATOR’. ‘SEPARATOR’ must be a string, a vector, or a list of characters.

FUNCTION’ must be a function of one argument, and must return a value that is a sequence of characters: either a string, or a vector or list of numbers that are valid character codepoints.

Example of mapconcat

(mapconcat 'symbol-name
           '(The cat in the hat)
           " ")
     ⇒ "The cat in the hat"

(mapconcat (lambda (x) (format "%c" (1+ x)))
           "HAL-8000"
           "")
     ⇒ "IBM.9111"