Skip to content

Commit 62bbd2f

Browse files
iterate: better working example
1 parent 8c9bc3c commit 62bbd2f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sources.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ where
177177
/// ```
178178
/// use itertools::iterate;
179179
///
180-
/// itertools::assert_equal(iterate(1, |&i| i * 3).take(5), vec![1, 3, 9, 27, 81]);
180+
/// itertools::assert_equal(iterate(1, |i| i % 3 + 1).take(5), vec![1, 2, 3, 1, 2]);
181181
/// ```
182182
///
183183
/// **Panics** if compute the next value does.
@@ -190,7 +190,7 @@ where
190190
/// it.next(); // `5 - 10` overflows.
191191
/// ```
192192
///
193-
/// You can alternatively use [`core::iter::successors`].
193+
/// You can alternatively use [`core::iter::successors`] as it better describes a finite iterator.
194194
pub fn iterate<St, F>(initial_value: St, f: F) -> Iterate<St, F>
195195
where
196196
F: FnMut(&St) -> St,

0 commit comments

Comments
 (0)