Day 3: Functional Concurrency
Over the previous two days, we’ve concentrated on parallelism. Today we’re going to change focus and look at concurrency. But before we do so, we’ll look deeper into why functional programming allows us to parallelize code so easily.
Same Structure, Different Evaluation Order
A common theme runs through everything we’ve seen over the last couple of days—functional programming allows us to play games with the order in which things are evaluated. If two calculations are independent, we can run them in any order we like, including in parallel.
The following code snippets all perform the same calculation, return the same result, and have almost identical structure, but they execute their component operations in very ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access