set
Syntax
set(X)
Arguments
X is a vector
Details
Return the corresponding set object of vector X .
Examples
Function set
returns a set.
x=set(4 5 5 2 3 11 6);
x;
// output
set(6,11,3,2,5,4)
x.intersection(set([2,5,9]));
// output
set(2,5)
In comparison, function distinct returns a vector.
distinct(4 5 5 2 3 11 6);
// output
[6,11,3,2,5,4]
Use function keys to convert sets to vectors:
x=set(4 5 5 2 3 11 6);
x.keys()
// output
[6,11,3,2,5,4]