Set is another datatype in Kebab. They resemble arrays/lists in the sense that they store multiple values inside, but the values aren't ordered and sets can be infinite.
There are 2 ways to declare sets in Kebab.
{1, 2, 3, 4, 5}
form and{x | 1 ≤ x ≤ 5; x ∊ N}
form that resembles the set notation in math:
Sets can also be infinite: {x|x>9}
You can check if a value is contained in a set using in
or ∊
.
2 in {1, 3, 4}
---> false
4 ∊ {1, 3, 4}
---> true
N
or ℕ
: Natural SetZ
or ℤ
: Integer SetQ
or ℚ
: Rational SetC
or ℂ
: Complex SetP
or 𝓟
: Prime Set∪
or union
: Union∩
or inter
: Intersection-
: Difference or Subtract (removes elements of one from the other set)sym
: Symmetric Difference=
: Equal Set≠
or !=
: Unequal Set