In Chapter 5, Programming Declaratively - A Better Style, we worked with some predefined higher-order functions and were able to see how their usage let us write declarative code, gaining in understandability as well as in compactness. In this new chapter, we are going to go further in the direction of higher-order functions, and we are going to develop our own. We can roughly classify the kinds of functions that we are going into three groups:
- Wrapped functions, that keep their original functionality, adding some kind of new feature. In this group, we can consider logging (adding log production capacity to any function), timing (producing time and performance data for a given function), and memoization (that caches results to avoid future re-work).
- Altered functions, that differ in some key point with their original versions. Here...