Wolfram Research

Function Repository Resource:

UniqueCases

Source Notebook

Similar to Cases, but removes duplicates

Contributed by: Taliesin Beynon

ResourceFunction["UniqueCases"][expr,patt]

is like Cases but returns deduplicated results.

Examples

Basic Examples

Find unique integer cases:

In[1]:=
ResourceFunction["UniqueCases"][{1, 1, 2.}, _Integer]
Out[1]=

Compare with Cases:

In[2]:=
Cases[{1, 1, 2.}, _Integer]
Out[2]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information