7 Purely functional parallelism

This chapter covers

  • Designing a purely functional library
  • Choosing appropriate data types and functions to model the domain
  • Reasoning about an API in terms of an algebra to discover types
  • Defining laws to govern API behavior
  • Generalizing combinators

Because modern computers have multiple cores per CPU and often multiple CPUs, it’s more important than ever to design programs in such a way that they can take advantage of this parallel processing power. But the interaction of parallel processes is complex, and the traditional mechanism for communication among execution threads—shared mutable memory—is notoriously difficult to reason about. This can all too easily result in programs that have race conditions and ...

Get Functional Programming in Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.