pub fn exhaustive_vecs_fixed_length_from_single<I: Iterator>(
    len: u64,
    xs: I
) -> ExhaustiveFixedLengthVecs1Input<I> where
    I::Item: Clone,
Expand description

Generates all Vecs of a given length with elements from a single iterator.

If xs is finite, the output length is $\ell^n$, where $\ell$ is xs.count() and $n$ is len. If xs is infinite, the output is also infinite.

If len is 0, the output consists of one empty Vec.

If xs is empty, the output is also empty, unless len is 0.

Examples

use itertools::Itertools;
use malachite_base::vecs::exhaustive::exhaustive_vecs_fixed_length_from_single;

let xss = exhaustive_vecs_fixed_length_from_single(2, 0..4).collect_vec();
assert_eq!(
    xss.iter().map(Vec::as_slice).collect_vec().as_slice(),
    &[
        &[0, 0],
        &[0, 1],
        &[1, 0],
        &[1, 1],
        &[0, 2],
        &[0, 3],
        &[1, 2],
        &[1, 3],
        &[2, 0],
        &[2, 1],
        &[3, 0],
        &[3, 1],
        &[2, 2],
        &[2, 3],
        &[3, 2],
        &[3, 3]
    ]
);