Operator Type:
Operator Scope of Action:
Operator Purpose:
Data Type Returned:
Operator First Added:
Operator in Current Baseline:
Operator Last Altered:
Function [other Function type actions]
List [operators of similar scope]
Data manipulation [other Data manipulation operators]
List [about List data type]
v9.5.0
Baseline
As at baseline
list.extend(aList)
for a List- or Set-type list, a nested list item is inserted as a new item at the end of the returned List. If passed back into a List, the order is maintained. If passed to a Set, the order of values may change.
The +=
increment operator, if passed a list as an argument, adds the arguments values to the existing list. By comparison, in the same scenario, list.extend() inserts the argument value as a nested list.
Long Tinderbox precedent holds that list addition adds each element of the two lists. For example
$MyList = [1] + [2;3]
resulst in the list 1;2;3
and not 1;[2;3]
. So, to add a sublist to a list, use the list.extend() operator. Thus:
$MyList = [1].extend( [2;3])
results in the list [1;[2;3]]
.
See also—notes linking to here: