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.

All functions