pub fn exhaustive_rational_sequences<I: Clone + Iterator>(
xs: I,
) -> ExhaustiveRationalSequences<I> ⓘ
Expand description
Generates all RationalSequence
s containing elements from a given iterator.
The input iterator should contain no repetitions, but this is not enforced.
The output length is 1 if the input iterator is empty, and infinite otherwise.
§Worst-case complexity per iteration
$T(i) = O(T^\prime(i) + (\log i)^{1+\varepsilon})$ for all $\varepsilon > 0$
$M(i) = O((\log i) M^\prime(i))$
where $T$ is time, $M$ is additional memory, and $T^\prime$ and $M^\prime$ are the time and memory functions of the input iterator.
§Examples
use itertools::Itertools;
use malachite_base::num::exhaustive::exhaustive_unsigneds;
use malachite_base::rational_sequences::exhaustive::exhaustive_rational_sequences;
use malachite_base::strings::ToDebugString;
assert_eq!(
exhaustive_rational_sequences(exhaustive_unsigneds::<u8>())
.take(10)
.collect_vec()
.to_debug_string(),
"[[], [[0]], [0], [[1]], [0, [1]], [1], [1, [0]], [0, 0, 0], [0, 0, 0, [1]], [[2]]]"
)