Functional Programming and Parallelization
Purely functional programs parallelize trivially because pure functions have no side effects. Languages like Haskell and Scala are well suited to parallelization, and impure functions advertise themselves through their type signatures. Discussed in ECE459 L11.
MapReduce
Joel Spolsky (quoted in L11): “Without understanding functional programming, you can’t invent MapReduce … purely functional programs have no side effects and are thus trivially parallelizable.” The
MapandReducenames come from Lisp.
Assumes no data dependency between functions. If you need the previous result, you wait. Write code like math: f(x, y, z) → (a, b, c).
Object-oriented programming encourages void methods. In a purely functional style, a no-return function is all side effect, which is exactly what parallelism wants to avoid.
Rust nudges toward functional style. Default immutability means function arguments are either immutable references (no mutation of the passed data) or transferred ownership (no concurrency on the old binding). Internal mutability exists but is discouraged.