pub fn lex_ordered_unique_vecs_fixed_length<I: Iterator>(
    k: u64,
    xs: I
) -> LexFixedLengthOrderedUniqueCollections<I, Vec<I::Item>> 
where I::Item: Clone,
Expand description

Generates Vecs of a given length 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 source iterator should not repeat any elements, but this is not enforced.

The order is lexicographic with respect to the order of the element iterator.

If $k$ is 0, the output length is 1.

If $k$ is nonzero and the input iterator is infinite, the output length is also infinite.

If $k$ is nonzero and the input iterator length is $n$, the output length is $\binom{n}{k}$.

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

If xs is empty, the output is also empty, unless $k$ is 0.

§Examples

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

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