Function malachite_base::num::exhaustive::primitive_int_increasing_range
source · pub fn primitive_int_increasing_range<T: PrimitiveInt>(
a: T,
b: T,
) -> PrimitiveIntIncreasingRange<T> ⓘ
Expand description
Generates all primitive integers 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. This
function cannot create a range that includes T::MAX
; for that, use
primitive_int_increasing_inclusive_range
.
The output is $(k)_{k=a}^{b-1}$.
The output length is $b - a$.
§Complexity per iteration
Constant time and additional memory.
§Panics
Panics if $a > b$.
§Examples
use itertools::Itertools;
use malachite_base::num::exhaustive::primitive_int_increasing_range;
assert_eq!(
primitive_int_increasing_range::<i8>(-5, 5).collect_vec(),
&[-5, -4, -3, -2, -1, 0, 1, 2, 3, 4]
)