**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 `0`

and `0.0`

as two distinct elements. The `null`

is treated as an empty set.

To build a set out of a vector, use the
`MakeSet`

function.
Currently, it will just return a new vector where every element is unique.

`genius>`

= [1, 2, 3]`MakeSet([1,2,2,3])`

Similarly there are functions
`Union`

,
`Intersection`

,
`SetMinus`

, which
are rather self explanatory. For example:

`genius>`

= [1, 2, 4, 3]`Union([1,2,3], [1,2,4])`

Note that no order is guaranteed for the return values. If you wish to sort the vector you
should use the
`SortVector`

function.

For testing membership, there are functions
`IsIn`

and
`IsSubset`

,
which return a boolean value. For example:

`genius>`

= true`IsIn (1, [0,1,2])`

The input ** IsIn(x,X)** is of course equivalent to

`IsSubset([x],X)`

`IsSubset(null,X)`