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

Generates all Vecs with lengths in $[a, b]$ 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 a (or 0 and 1, if a is 0) are ever produced.

The output length is $$ \sum_{k=a}^b n^k, $$ where $k$ is xs.count().

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_length_inclusive_range;

let bss = shortlex_vecs_length_inclusive_range(2, 3, exhaustive_bools()).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]
    ]
);