Concatenation( list1, list2..
)
Concatenation( list )
In the first form Concatenation returns the concatenation of the
lists list1, list2, etc. The concatenation
is the list that begins with the elements of list1, followed by
the elements of list2 and so on. Each list may also contain holes,
in which case the concatenation also contains holes at the corresponding
positions.
gap> Concatenation( [ 1, 2, 3 ], [ 4, 5 ] );
[ 1, 2, 3, 4, 5 ]
gap> Concatenation( [2,3,,5,,7], [11,,13,,,,17,,19] );
[ 2, 3,, 5,, 7, 11,, 13,,,, 17,, 19 ]
In the second form list must be a list of lists list1,
list2, etc, and Concatenation returns the
concatenation of those lists.
gap> Concatenation( [ [1,2,3], [2,3,4], [3,4,5] ] );
[ 1, 2, 3, 2, 3, 4, 3, 4, 5 ]
The result is a new list, that is not identical to any other list. The elements of that list however are identical to the corresponding elements of the argument lists (see Identical Lists).
Note that Concatenation creates a new list and leaves it
arguments unchanged, while Append (see Append) changes its first
argument. As usual the name of the function that works destructively is a
verb, but the name of the function that creates a new object is a substantive.
Set(Concatenation(set1,set2..)) (see
Set) is a way to compute the union of sets, however, Union (see
Union) is more efficient.