Function setSize #

Count the number of elements of a (multi)set. When a second parameter is ‘true’, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.

Syntax #

math.setSize(set)
math.setSize(set, unique)

Parameters #

Parameter Type Description
a Array | Matrix A multiset
unique boolean If true, only the unique values are counted. False by default

Returns #

Type Description
number The number of elements of the (multi)set

Throws #

Type | Description —- | ———–

Examples #

math.setSize([1, 2, 2, 4])          // returns 4
math.setSize([1, 2, 2, 4], true)    // returns 3

See also #

setUnion, setIntersect, setDifference

Fork me on GitHub