Skip to content

Commit 6026b8b

Browse files
authored
Merge pull request #1560 from balroggg/refactor_fn_hof
Change fold to sum in fn hof.md
2 parents 81dbb3d + 3072303 commit 6026b8b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/fn/hof.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn main() {
3636
(0..).map(|n| n * n) // All natural numbers squared
3737
.take_while(|&n_squared| n_squared < upper) // Below upper limit
3838
.filter(|&n_squared| is_odd(n_squared)) // That are odd
39-
.fold(0, |acc, n_squared| acc + n_squared); // Sum them
39+
.sum(); // Sum them
4040
println!("functional style: {}", sum_of_squared_odd_numbers);
4141
}
4242
```

0 commit comments

Comments
 (0)