We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 81dbb3d + 3072303 commit 6026b8bCopy full SHA for 6026b8b
src/fn/hof.md
@@ -36,7 +36,7 @@ fn main() {
36
(0..).map(|n| n * n) // All natural numbers squared
37
.take_while(|&n_squared| n_squared < upper) // Below upper limit
38
.filter(|&n_squared| is_odd(n_squared)) // That are odd
39
- .fold(0, |acc, n_squared| acc + n_squared); // Sum them
+ .sum(); // Sum them
40
println!("functional style: {}", sum_of_squared_odd_numbers);
41
}
42
```
0 commit comments