Function setDistinct #
Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation. The items of the returned array will be sorted in natural order.
Syntax #
math.setDistinct(set)
Parameters #
| Parameter | Type | Description |
|---|---|---|
a |
Array | Matrix | A multiset |
Returns #
| Type | Description |
|---|---|
| Array | Matrix | A set containing the distinct elements of the multiset |
Throws #
Type | Description —- | ———–
Examples #
math.setDistinct([1, 1, 1, 2, 2, 3]) // returns [1, 2, 3]