### 5.2.7 Concatenation of a list of strings

The concat and sum commands concatenate elements of a list of strings together into a single string.

- concat and sum both take L, a list of strings.
- concat(L) and sum(L) both return the string obtained by lst concatenating strings from L together in the given order.

The join command concatenates a list of strings after inserting a specified separator string between adjacent elements.

- join takes two arguments:
  - sep, a string specifying the separator.
  - L, a list of strings s1,s2,…,sn.
- join(sep,L) returns the string s1+sep+s2+sep+..+sn.

The cumSum command works on strings like it does on expressions by doing partial concatenation (see Section 6.3.26).

- cumSum takes L, a list of strings.
- cumSum(L) returns a sequence of strings where the element of index k is the concatenation of the strings in L with indices 0 to k.

#### Examples

sum("Hello, ","is ","that ","you?")

“Hello, is that you?” |  |  |  |  |  |  |  |  |  |

join(" ",["Hello,","is","that","you?"])

“Hello, is that you?” |  |  |  |  |  |  |  |  |  |

cumSum("Hello, ","is ","that ","you?")

“Hello, ”,“Hello, is ”, “Hello, is that ”,“Hello, is that you?” |  |  |  |  |  |  |  |  |  |