In the Functions currying recipe, we discovered a neat way of transforming a function to extract new functions from it. In this recipe, we are going to work on implementing the opposite transformation. It would be useful to have the option to merge a number of existing functions' declarations and define a new function from them. This is a common functional programming pattern called functions composition. Kotlin doesn't provide function composition mechanism out of the box. However, thanks to the extended built-in support for operations on functional types, we are able to implement a reusable mechanism for the composition manually.
Function composition
Getting ready
In order to get familiar with function composition...