Strings in lexicographic order (silo)

The function silo can be used to iterate through strings in lexicographic order in some range.

silo(alphabet: str, upper_bound: int, first: str, last: str) Iterator

Returns an iterator to strings in lexicographic order (silo).

Parameters
  • alphabet (str) -- the alphabet

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

  • first (str) -- the first string

  • last (str) -- one past the last string

Returns

An iterator to strings in lexicographic order over the alphabet alphabet of length at most upper_bound in the range [first, last).

>>> from libsemigroups_pybind11 import silo
>>> list(silo("ba", 3, "b", "aaa"))
['b', 'bb', 'ba', 'a', 'ab', 'aa']