Parallel Map: The “Hello, World” of Erlang

Understand how parallel maps work in Elixir.

We'll cover the following

Introduction

Every book in the Erlang space must, by law, include a parallel map function. Regular map returns the list that results from applying a function to each element of a collection. The parallel version does the same, but it applies the function to each element in a separate process.

Run the following commands in order to execute the code below:

  • c("pmap.exs")
  • Parallel.pmap 1..10, &(&1 * &1)

Get hands-on with 1400+ tech skills courses.