“Pat yourself on the back! You have both used and implemented the built-in function reduce, perhaps the most dreaded of all sequence functions.”
What did we read about?
It’s our seventh week of ‘Functional Programming for the Object-Oriented Programmer‘ by Brian Manick.
We come to the end of the “Embedding and Object Oriented Language” with some exercises and a bit of wrap up.
Begin on Page 73 at section 6.4 Exercises
- Exercise 1 (Page 73)
- Exercise 2 (Page 74)
- Exercise 3
- Exercise 4 (Page 75)
- Exercise 5
- Exercise 6
Finish at Page 77 at the end of chapter 6
What stood out?
- Anybody playing the functional tutorial drinking game can take two drinks: one for recursion and the other for factorial 😉
- The answer for each exercise feeds into the next, building up the complexity to use increasingly sophisticated forms of recursion.
- The exercises conclude by introducing the powerful reduce function.
If you read nothing else this week…
- Whatever you do make sure you complete exercises 1 to 6.
- Exercise 5 is partially tricky, kudos if you complete it without hints! (note the result doesn’t have to be in-order)