Chapter 10 Contents¶
– Pages 347 to 384, 37 pages total.
Epigraph
10.1 Folds
10.2 Bringing you into the fold 348-349 5p 4f
10.3 Recursive patterns 350-351 6p 4f
10.4 Fold right 351 2p 1f
10.4.1 How
foldr
evaluates 351-358 35p 27f
10.5 Fold left 359-360 7p 4f
10.5.1 Associativity and folding 360-364 20p 13f
10.5.2 Exercises: Understanding folds 364-366
10.5.3 Unconditional spine recursion 366-367 6p 4f
10.6 How to write fold functions 367-370 16p 13f
10.6.1 Exercises: Database processing 370-372
10.7 Folding and evaluation 372-374 8p 7f
10.8 Summary
10.8.1
foldr
10.8.2
foldl
10.9 Scans
10.9.1 Getting the Fibonacci number we want
10.9.2 Scans exercises
10.10 Chapter Exercises
10.10.1 Warm-up and review
10.10.2 Rewriting functions using folds
10.11 Definitions
10.11.1 fold
10.11.2 catamorphism
10.11.3 tail call
10.11.4 tail recursion
10.12 Follow-up resources