September 2023
Intermediate to advanced
470 pages
11h 12m
English
The exercises in this chapter will focus on DDT and higher-order functions.
Here is your friendly reminder that nobody can learn functional programming by just reading code, and the best way to learn is by practicing. You can refer to the exercises folder in the book code repository for the starting point and some hints.
Looking at the instruction on the Pesticide website, try to create a DDT, DomainOnly. It has to be written from the perspective of a customer using a self-checkout machine, adding a single food item, and verifying the total.
Something like this:
| | enum class Item { carrot, milk } |
| | |
| | interface CashierActions : DdtActions<DdtProtocol> { |
| | fun setupPrices(prices: Map<String, Double>) ... |
Read now
Unlock full access