setSize

setSize(set)

setSize(set, unique)

Try it yourself:


Count distinct members with setSize

setSize returns the cardinality of a set: the number of unique members it contains. It is different from counting repeated entries in a list.

Example

The set {a,b,c} has size 3. Use count for raw collection length and setDistinct to remove duplicates before reasoning about membership.

Applications

Set size helps assess overlap and combinatorial growth. Pair it with setIntersect for shared values, setUnion for combined membership, and setPowerset when estimating an exhaustive subset search.

Try Set Size 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