pub fn exhaustive_fixed_length_strings_using_chars<I: Iterator<Item = char>>(
len: u64,
cs: I,
) -> StringsFromCharVecs<ExhaustiveFixedLengthVecs1Input<I>> ⓘ
Expand description
Generates all String
s of a given length with char
s from a single iterator.
If cs
is finite, the output length is $\ell^n$, where $\ell$ is cs.count()
and $n$ is len
.
If cs
is infinite, the output is also infinite.
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::exhaustive_fixed_length_strings_using_chars;
let ss = exhaustive_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", "ac", "aa", "ct", "at", "tc", "ta", "tt"]
);