setDistinct

setDistinct(set)

Try it yourself:


Keep unique values with setDistinct

setDistinct removes duplicate members from a collection according to set equality. It prepares lists for membership checks and set operations.

Example

Applying it to [1,1,2,3,3] leaves 1, 2, and 3. Use setSize to count unique members and setUnion to combine unique memberships from sources.

Caveats

Distinctness depends on value equality; objects and floating-point values may require care. Use deepEqual to understand structural comparisons, and do not use distinctness when repeated frequency is essential—use mode instead.

Try Set Distinct in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions