Skip to content

Union

Union[expr1, expr2, ...] returns a sorted union of the items in the expressions.

Attributes[Union] := {Protected}

Simple examples

In[1]:= Union[{b, a, a, b, a}]
Out[1]= {a, b}
In[2]:= Union[{b, a, a, b, a}, {y, z}]
Out[2]= {a, b, y, z}
In[3]:= Union[foo[b, a, a, b, a], foo[y, z]]
Out[3]= foo[a, b, y, z]