pub fn exhaustive_vecs_length_range<I: Clone + Iterator>(
    a: u64,
    b: u64,
    xs: I
) -> ExhaustiveVecs<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.

  • If $a \geq b$, the output length is 0.
  • If $a = 0$ and $b = 1$, the output length is 1.
  • If $a < b$, $b > 1$, and xs is infinite, the output length is infinite.
  • If xs is finite, the output length is $$ \sum_{k=a}^{b-1} n^k, $$ where $k$ is xs.count().

The lengths of the output Vecs grow logarithmically.

§Examples

use itertools::Itertools;
use malachite_base::num::exhaustive::exhaustive_unsigneds;
use malachite_base::vecs::exhaustive::exhaustive_vecs_length_range;

let xss = exhaustive_vecs_length_range(2, 4, exhaustive_unsigneds::<u32>())
    .take(20)
    .collect_vec();
assert_eq!(
    xss.iter().map(Vec::as_slice).collect_vec().as_slice(),
    &[
        &[0, 0][..],
        &[0, 0, 0],
        &[0, 1],
        &[1, 0],
        &[1, 1],
        &[0, 0, 1],
        &[0, 2],
        &[0, 1, 0],
        &[0, 3],
        &[0, 1, 1],
        &[1, 2],
        &[1, 3],
        &[2, 0],
        &[1, 0, 0],
        &[2, 1],
        &[3, 0],
        &[3, 1],
        &[1, 0, 1],
        &[2, 2],
        &[2, 3]
    ]
);