Function Repository Resource:

UniqueCases

Source Notebook

Similar to Cases, but removes duplicates

Contributed by: Taliesin Beynon

ResourceFunction["UniqueCases"][expr,patt]

gives a deduplicated list of the ei that match the pattern patt.

Examples

Basic Examples (2) 

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

Version History

  • 1.0.0 – 10 January 2019

License Information