pub fn shortlex_vecs_min_length<I: Clone + Iterator>(
    min_length: u64,
    xs: I
) -> ShortlexVecs<I::Item, PrimitiveIntIncreasingRange<u64>, I> 
where I::Item: Clone,
Expand description

Generates all Vecs with a minimum length and with elements from a specified iterator, in shortlex order.

Shortlex order means that the Vecs are output from shortest to longest, and Vecs of the same length are output in lexicographic order with respect to the ordering of the Vec elements specified by the input iterator.

xs must be finite; if it’s infinite, only Vecs of length min_length (or 0 and 1, if min_length is 0) are ever produced.

If xs is empty and min_length is 0, the output length is 1; if xs is empty and min_length is greater than 0, the output is empty; otherwise, the output is infinite.

The lengths of the output Vecs grow logarithmically.

§Examples

use itertools::Itertools;
use malachite_base::bools::exhaustive::exhaustive_bools;
use malachite_base::vecs::exhaustive::shortlex_vecs_min_length;

let bss = shortlex_vecs_min_length(2, exhaustive_bools())
    .take(20)
    .collect_vec();
assert_eq!(
    bss.iter().map(Vec::as_slice).collect_vec().as_slice(),
    &[
        &[false, false][..],
        &[false, true],
        &[true, false],
        &[true, true],
        &[false, false, false],
        &[false, false, true],
        &[false, true, false],
        &[false, true, true],
        &[true, false, false],
        &[true, false, true],
        &[true, true, false],
        &[true, true, true],
        &[false, false, false, false],
        &[false, false, false, true],
        &[false, false, true, false],
        &[false, false, true, true],
        &[false, true, false, false],
        &[false, true, false, true],
        &[false, true, true, false],
        &[false, true, true, true]
    ]
);