pub fn iterate<St, F>(initial_value: St, f: F) -> Iterate<St, F> ⓘwhere
F: FnMut(&St) -> St,
Expand description
Creates a new iterator that infinitely applies function to value and yields results.
use itertools::iterate;
itertools::assert_equal(iterate(1, |&i| i * 3).take(5), vec![1, 3, 9, 27, 81]);