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.
enumerate()
returns list of elements of the set.
index(i)
takes a positive integer i
less than or equal to size()
and returns the i
-
th element of the set. This operation establishes a bijection between the elements of the finite set and 1..size()
.
lookup(x)
returns a positive integer such that x = index lookup x
.
random()
returns a random element from the set.
size()
returns the number of elements in the set.