上QQ阅读APP看书,第一时间看更新
Intermediate functions
Intermediate functions are not evaluated until the terminal function has been processed.
Lazy evaluation is an evaluation strategy that delays the processing of an intermediate function until its value is required. It can be combined with memoization, where the evaluation is first cached so that subsequent requests for that value return the cached value immediately without reevaluating the expression that originally created it.
A few of the more popular intermediate functions include map, filter, and sort.
We can create many other high-order functions to process the incoming stream, which is often a collection. We'll soon see functional programming libraries that provide a plethora of variations of these basic function types.