pub fn lex_fixed_length_strings_using_chars<I: Iterator<Item = char>>(
len: u64,
cs: I,
) -> StringsFromCharVecs<LexFixedLengthVecsFromSingle<I>> ⓘ
Expand description
Generates all [String
]s of a given length with char
s from a single iterator, in
lexicographic order.
The order is lexicographic with respect to the order of the element iterator.
cs
must be finite.
The output length is $\ell^n$, where $\ell$ is cs.count()
and $n$ is len
.
If len
is 0, the output consists of one empty [String
].
If cs
is empty, the output is also empty, unless len
is 0.
§Examples
use itertools::Itertools;
use malachite_base::strings::exhaustive::lex_fixed_length_strings_using_chars;
let ss = lex_fixed_length_strings_using_chars(2, ['c', 'a', 't'].iter().cloned()).collect_vec();
assert_eq!(
ss.iter().map(|cs| cs.as_str()).collect_vec().as_slice(),
&["cc", "ca", "ct", "ac", "aa", "at", "tc", "ta", "tt"]
);