Table of Contents
Genius has some basic set theoretic functionality built in. Currently a set is just a vector (or a matrix). Every distinct object is treated as a different element.
Just like vectors, objects
in sets can include numbers, strings,
null, matrices and vectors. It is
planned in the future to have a dedicated type for sets, rather than using vectors.
Note that floating point numbers are distinct from integers, even if they appear the same.
That is, Genius will treat
as two distinct elements. The
null is treated as an empty set.
To build a set out of a vector, use the
Currently, it will just return a new vector where every element is unique.
MakeSet([1,2,2,3])= [1, 2, 3]
Union([1,2,3], [1,2,4])= [1, 2, 4, 3]
Note that no order is guaranteed for the return values. If you wish to sort the vector you
should use the
IsIn (1, [0,1,2])= true
IsIn(x,X) is of course equivalent to
IsSubset([x],X). Note that since the empty set is a subset
of every set,
IsSubset(null,X) is always true.