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.

=: (%, %) -> Boolean

from BasicType

~=: (%, %) -> Boolean

from BasicType

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 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().

latex: % -> String

from SetCategory

lookup: % -> PositiveInteger

lookup(x) returns a positive integer such that x = 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

BasicType

CoercibleTo OutputForm

Comparable

ConvertibleTo InputForm

Hashable

SetCategory