Parallel map.
Пак ли?
defmodule TaskEnum do
def map(enumerable, fun, opts \\ []) do
max_workers = Keyword.get(opts, :max_workers, System.schedulers_online())
ordered = Keyword.get(opts, :ordered, true)
enumerable
|> Task.async_stream(fun, max_workers: max_workers, ordered: ordered)
|> Stream.map(fn {:ok, val} -> val end)
|> Enum.to_list()
end
end