Functional design patterns
Having seen several OOP design patterns, it may seem a cheat to say that there’s no approved, official, or even remotely generally accepted similar list of patterns for FP. There are, however, several problems for which there are standard FP solutions, which can be considered design patterns on their own, and we have already covered most of them in this book.
What are the candidates for a possible list of patterns? Let’s attempt to prepare one – but remember that it’s just a personal view. Also, I’ll admit that I’m not trying to mimic the usual style of pattern definition; I’ll just be mentioning a general problem and refer to the way FP in JavaScript can solve it, and I won’t be aiming for nice, short, and memorable names for the patterns either:
- Processing collections using filter/map/reduce: Whenever you have to process a data collection, using declarative higher-order functions such as...