September 2023
Intermediate to advanced
470 pages
11h 12m
English
The exercises in this chapter will focus on combining functions together.
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.
In this exercise, we want to improve the readability of a chain of functions. At the beginning of this chapter we had the following code:
| | request |
| | .let(::extractListData) |
| | .let(::fetchListContent) |
| | .let(::renderHtml) |
| | .let(::createResponse) |
Using Kotlin infix (see Infix Functions) format we can transform it to a more declarative style like this:
| | val processFun = ::extractListData ... |
Read now
Unlock full access