pub fn shortlex_ordered_unique_vecs_length_inclusive_range<I: Clone + Iterator>(
    a: u64,
    b: u64,
    xs: I
) -> ShortlexOrderedUniqueCollections<I, Vec<I::Item>> 
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, and the elements in each Vec are ordered the same way as they are in the source iterator.

The Vecs are generated in order of increasing length, and within each length they are ordered lexicographically with respect to the order of the element iterator.

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

The iterator should be finite; if it is infinite, Vecs of length \max(2, a + 1) and above will never be generated.

If $a < b$, the output is empty.

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

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

If the input iterator length is $n$, the output length is $$ \sum_{i=a}^b \binom{n}{i}. $$

§Examples

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

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