pub fn exhaustive_natural_range(
    a: Natural,
    b: Natural
) -> ExhaustiveNaturalRange 
Expand description

Generates all Naturals in the half-open interval $[a, b)$, in ascending order.

a must be less than or equal to b. If a and b are equal, the range is empty. To generate all Naturals in an infinite interval, use exhaustive_natural_range_to_infinity.

The output is $(k)_{k=a}^{b-1}$.

The output length is $b - a$.

§Worst-case complexity per iteration

$T(i) = O(i)$

$M(i) = O(i)$

where $T$ is time, $M$ is additional memory, and $i$ is the iteration number.

Although the time and space complexities are worst-case linear, the worst case is very rare. If we exclude the cases where the least-significant limb of the previously-generated value is Limb::MAX, the worst case space and time complexities are constant.

§Panics

Panics if $a > b$.

§Examples

use itertools::Itertools;
use malachite_base::strings::ToDebugString;
use malachite_nz::natural::exhaustive::exhaustive_natural_range;
use malachite_nz::natural::Natural;

assert_eq!(
    exhaustive_natural_range(Natural::from(5u32), Natural::from(10u32)).collect_vec()
            .to_debug_string(),
    "[5, 6, 7, 8, 9]"
)