Skip to content

Instantly share code, notes, and snippets.

@boudra
Created May 18, 2016 16:04
Show Gist options
  • Select an option

  • Save boudra/406d69a37e636b4fc3f0910e911913d3 to your computer and use it in GitHub Desktop.

Select an option

Save boudra/406d69a37e636b4fc3f0910e911913d3 to your computer and use it in GitHub Desktop.
Parallel Map in Elixir
def parallel_map(enum, cb) do
Enum.map(enum, &(Task.async(fn() -> apply(cb, [&1]) end)))
|> Enum.map(&Task.await(&1))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment