Chapter 14. Writing parallel functional programs
This chapter covers
- Using immutable data to simplify parallelization
- Working with the Task Parallel library
- Expressing parallelism declaratively using LINQ
- Implementing overloaded operators
We’ve already seen many arguments in favor of functional programming. One reason it’s becoming increasingly important these days is parallelism. Writing code that scales to a large number of cores is much easier in the functional style compared to using the typical imperative approach.
The two concepts from the functional world that are essential for parallel computing are the declarative programming style and working with immutable data structures. These two are closely related. The code becomes more declarative when using immutable data, because the code is more concerned with the expected result of the computation than with the details of copying and changing data. Both concepts are important in different ways when it comes to parallelization.