Spreading and destructuring
Copy a prefix into a new sequence
Destructure the first item and collect the rest. Then use a spread to build a separate list.
[first, ...tail] = [8, 12, 15]
combined = [first, ...tail, 19]
print(count(combined))
4
The rest binding collects two items. The spread adds both of them to the new array.
Array and call spreading supplies values in iteration order. Spreading into a hybrid table appends dense values and copies associative entries by key when the source is a table or dictionary. Duplicate keys take the last value.
Positional destructuring assigns the named bindings from successive indices. A rest binding ...name collects a suffix into an array. Dictionary destructuring with {name, other} reads the corresponding named entries. Assignment targets and arguments evaluate from left to right. Compound member and index assignment evaluates each target component once.