This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

Union

 Uniongives a sorted list of all the distinct elements that appear in any of the . Union[list]gives a sorted version of a list, in which all duplicated elements have been dropped.
• If the are considered as sets, Union gives their union.
• The must have the same head, but it need not be List.
• Union[list1, ..., SameTest->test] applies test to each pair of elements in the to determine whether they should be considered the same.
Give a sorted list of distinct elements:
Give a sorted list of distinct elements from all the lists:
Enter using Esc un Esc:
Give a sorted list of distinct elements:
 Out[1]=

Give a sorted list of distinct elements from all the lists:
 Out[1]=

Enter using Esc un Esc:
 Out[1]=
 Scope   (1)
Give a list of the distinct lists:
Union works with any head, not just List:
 Options   (4)
Use equivalence classes based on absolute value:
Use equivalence classes based on Floor:
Use Total of list elements:
Use equality of last and first elements:
 Applications   (4)
Find divisors that occur in any of 10, 12, and 20:
Find all the triples of bits that occur in the binary decomposition of 10!:
Find the distinct elements in the iteration:
Find what options are used by a list of functions:
Split on the sorted set gives lists of the same elements:
The union is equivalent to the first elements of these lists:
Tally gets the count of identical elements and returns them in the original order:
The union is the sorted list of the elements returned by Tally:
For large sets Union may be slow with SameTest since it requires all pairwise comparisons:
When equivalence class representatives can be found, it may be faster to use Union on these:
The results are the same except for the choice of representative: