Words
The strings of length over a -letter alphabet .
Words(size, base)the strings of length over a -letter alphabet Typed signatures
| Type | Package | Applies |
|---|---|---|
(integer<0..>, integer<0..>) -> indexed_collection<word> | combinatorics | always |
Details
- Count is ; the same family as Tuples, with grades reordered.
Definition
Epsil, as the implementation runs it.
count(_size, _base)
1 if _size == 0 else _base ^ _sizeunrank(_size, _base, _r)
Map(Function(
(_r - _r % _base ^ (_size - j)) / _base ^ (_size - j) % _base + 1,
j,
), Range(1, _size, 1))rank(_size, _base, _x)
Fold(Function(acc * _base + (_x[j] - 1), acc, j), 0, Range(1, _size, 1))valid(_size, _base, _x)
Length(_x) == _size && Fold(
Function(ok_j && 1 <= _x[j] && _x[j] <= _base + 1 -
1, ok_j, j),
True,
Range(1, Length(_x), 1),
)Enumeration
Examples
1 more kept as data, checked against the oracles See also: Tuples, BinaryWords