pub fn iterate<St, F>(initial_value: St, f: F) -> Iterate<St, F>Notable traits for Iterate<St, F>impl<St, F> Iterator for Iterate<St, F> where
    F: FnMut(&St) -> St, 
type Item = St;
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]);