pub fn primitive_int_increasing_inclusive_range<T: PrimitiveInt>(
a: T,
b: T
) -> PrimitiveIntIncreasingRange<T>ⓘNotable traits for PrimitiveIntIncreasingRange<T>impl<T: PrimitiveInt> Iterator for PrimitiveIntIncreasingRange<T> type Item = T;
Expand description
Generates all primitive integers in the closed interval $[a, b]$, in ascending order.
$a$ must be less than or equal to $b$. If $a$ and $b$ are equal, the range contains a single element.
The output is $(k)_{k=a}^{b}$.
The output length is $b - a + 1$.
Complexity per iteration
Constant time and additional memory.
Panics
Panics if $a > b$.
Examples
extern crate itertools;
use itertools::Itertools;
use malachite_base::num::exhaustive::primitive_int_increasing_inclusive_range;
assert_eq!(
primitive_int_increasing_inclusive_range::<i8>(-5, 5).collect_vec(),
&[-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
)