Function malachite_base::num::exhaustive::exhaustive_natural_signeds
source · [−]pub fn exhaustive_natural_signeds<T: PrimitiveSigned>(
) -> PrimitiveIntIncreasingRange<T>ⓘNotable traits for PrimitiveIntIncreasingRange<T>impl<T: PrimitiveInt> Iterator for PrimitiveIntIncreasingRange<T> type Item = T;
Expand description
Generates all natural (non-negative) signed integers in ascending order.
The output is $(k)_{k=0}^{2^{W-1}-1}$, where $W$ is the width of the type.
The output length is $2^{W-1}$.
Complexity per iteration
Constant time and additional memory.
Examples
use malachite_base::iterators::prefix_to_string;
use malachite_base::num::exhaustive::exhaustive_natural_signeds;
assert_eq!(
prefix_to_string(exhaustive_natural_signeds::<i8>(), 10),
"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...]"
)