Words in lexicographic order (wilo)

The function wilo can be used to iterate through words in lexicographic order in some range.

wilo(n: int, upper_bound: int, first: List[int], last: List[int]) Iterator

Returns an iterator to words in lexicographic order (wilo).

Parameters
  • n (int) -- the number of letters

  • upper_bound (int) -- the maximum length of string to return

  • first (list) -- the first word

  • last (list) -- one past the last word

Returns

An iterator to words in lexicographic order over an alphabet with n letters of length at most upper_bound in the range [first, last).

>>> from libsemigroups_pybind11 import wilo
>>> list(wilo(2, 3, [0], [1, 1, 1]))
[[0], [0, 0], [0, 1], [1], [1, 0], [1, 1]]