pub fn exhaustive_unique_vecs_length_range<I: Iterator>(
    a: u64,
    b: u64,
    xs: I
) -> ExhaustiveUniqueVecs<I> where
    I::Item: Clone,
Expand description

Generates Vecs, with lengths in a range $[a, b)$, with elements from a single iterator, such that each Vec has no repeated elements.

The source iterator should not repeat any elements, but this is not enforced.

If $a \leq b$, the output is empty.

If $a = 0$ and $b = 1$, the output consists of a single empty Vec.

If the input iterator is infinite and $0 < a < b$, the output length is also infinite.

If the input iterator length is $n$, the output length is $$ \sum_{i=a}^{b - 1} \frac{n!}{k!}. $$

Examples

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

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