Prev: sublist

union

union(list1, list2)
This function returns the result of adding each element of list2 which does not already exist in list1 to the elements of list1. Elements which exist in list2 more than once will only be added once, but duplicate elements in list1 will remain.

union([2, 3, 4], [4, 5, 4, 6])
     => [2, 3, 4, 5, 6]
union([2, 2, 4, 5], [4, 5, 6, 6, 7])
     => [2, 2, 4, 5, 6, 7])