Expand/Shrink

Concatenation

Any two objects may be concatenated using the & operator. The result is a sequence with a length equal to the sum of the lengths of the concatenated objects, where atoms are considered here to have length 1. e.g.
    {1, 2, 3} & 4              -- {1, 2, 3, 4}
    4 & 5                      -- {4, 5}
    {{1, 1}, 2, 3} & {4, 5}    -- {{1, 1}, 2, 3, 4, 5}
    x = {}
    y = {1, 2}
    y = y & x                  -- y is still {1, 2}
    z = "this"&"that"          -- z is "thisthat"
You can delete element i of any sequence s by concatenating the parts of the sequence before and after i:
    s = s[1..i-1] & s[i+1..length(s)]
This works even when i is 1 or length(s), since s[1..0] is a legal empty slice, and so is s[length(s)+1..length(s)].

Alternatively you can replace a slice with an empty sequence:
    s[i..i] = {}
Note however this is not compatible with Euphoria.

TIP: & is ideal for constructing strings. When adding individual elements to (a sequence which represents) a list or table consider using append or prepend instead.

See also Other Operations on Sequences for a detailed explanation of the similarities and differences between concatenation and append/prepend.