parMap applies a function to every element of a List in parallel and returns a Par computation containing the resulting List. It separates describing the computation from running it, leaving execution to the Par abstraction. section 7.0
Basic use
val outputList = parMap(inputList)(f) section 7.0
The implementation builds the operation from existing combinators rather than treating it as a new primitive. asyncF turns f into computations for individual elements; sequence collects a List[Par[B]] into a Par[List[B]]; fork packages the combined computation for parallel execution. section 7.2.1
A compact implementation follows three steps:
- Use sequence to transform the list of parallel computations into one Par computation of a result list. section 7.2.1
val outputList = parMap(inputList)(f)
Inspect the minimal call site for applying a function across a list. section 7.0
