In Chapter 5, Programming Declaratively – A Better Style, we worked with some predefined higher-order functions and were able to see how their usage lets us write declarative code so that we can gain in understandability as well as in compactness. In this chapter, we are going to go further in the direction of higher-order functions and develop our own. We can roughly classify the kinds of results that we are going to get into three groups:
- Wrapped functions: These keep their original functionality while 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 (this caches results to avoid future rework).
- Altered functions: These differ in some key points from their...