This chapter builds upon the basic F# idioms in functions, pattern matching, and data sequences that we have observed in the previous chapters. Here, I turn to the advanced patterns of data transformations, in other words, the repeated use of functions over data. The goal of this chapter is to familiarize you with the major patterns where combined basic F# idioms work in synergy. This chapter covers the following topics:
Advanced recursion patterns, including tail recursion and the mutual recursion of functions and sequences
Folding as a universal pattern of aggregation
Memoization and lazy evaluation as complementary patterns of the just-in-time principle applied to data
The continuation passing pattern extending the core call-return principle of function interaction
Advanced pattern matching by generalizing matching with active patterns
These synergies often manifest themselves in clean, concise, and efficient F# code.