pub fn exhaustive_hash_sets_fixed_length<I: Clone + Iterator>(
    k: u64,
    xs: I,
) -> ExhaustiveOrderedUniqueCollections<I, HashSet<I::Item>> 
where I::Item: Clone + Eq + Hash,
Expand description

Generates HashSets of a given size with elements from a single iterator.

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

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 HashSet.

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

§Examples

use itertools::Itertools;
use malachite_base::sets::exhaustive::exhaustive_hash_sets_fixed_length;
use maplit::hashset;

let xss = exhaustive_hash_sets_fixed_length(4, 1..=6).collect_vec();
assert_eq!(
    xss,
    &[
        hashset! {1, 2, 3, 4},
        hashset! {1, 2, 3, 5},
        hashset! {1, 2, 4, 5},
        hashset! {1, 3, 4, 5},
        hashset! {2, 3, 4, 5},
        hashset! {1, 2, 3, 6},
        hashset! {1, 2, 4, 6},
        hashset! {1, 3, 4, 6},
        hashset! {2, 3, 4, 6},
        hashset! {1, 2, 5, 6},
        hashset! {1, 3, 5, 6},
        hashset! {2, 3, 5, 6},
        hashset! {1, 4, 5, 6},
        hashset! {2, 4, 5, 6},
        hashset! {3, 4, 5, 6}
    ]
);