Created
May 18, 2016 16:04
-
-
Save boudra/406d69a37e636b4fc3f0910e911913d3 to your computer and use it in GitHub Desktop.
Parallel Map in Elixir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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