FiniteΒΆ
catdef.spad line 610 [edit on github]
The category of domains composed of a finite set of elements. We include the functions lookup and index to give a bijection between the finite set and an initial segment of positive integers.
- coerce: % -> OutputForm
from CoercibleTo OutputForm
- convert: % -> InputForm
from ConvertibleTo InputForm
- enumerate: () -> List %
enumerate()
returns list of elements of the set.
- hash: % -> SingleInteger
from Hashable
- hashUpdate!: (HashState, %) -> HashState
from Hashable
- index: PositiveInteger -> %
index(i)
takes a positive integeri
less than or equal tosize()
and returns thei
-
th element of the set. This operation establishes a bijection between the elements of the finite set and1..size()
.
- latex: % -> String
from SetCategory
- lookup: % -> PositiveInteger
lookup(x)
returns a positive integer such thatx = index lookup x
.
- random: () -> %
random()
returns a random element from the set.
- size: () -> NonNegativeInteger
size()
returns the number of elements in the set.
- smaller?: (%, %) -> Boolean
from Comparable