In the previous chapter, we discussed recursion for repeating the function invocation in the functional approach. Now, we will discuss lazy evaluation that can make our code become more efficient since it will only run when we need it. We will also apply recursion, the topic we talked about in the previous chapter, to produce the lazy code.
In this chapter, we discuss lazy evaluation to make code run faster. This will make the code become efficient since it will make sure that unnecessary code won't be executed. The following are the topics we will discuss to dive into lazy evaluation:
- Distinguishing the difference between eager and lazy evaluation
- Optimizing code using the caching technique
- Refactoring eager evaluation into lazy evaluation
- Designing the useful classes that can be reused in others' functional...