Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The Task module is great for this kind of thing, too. http://elixir-lang.org/docs/v1.0/elixir/Task.html

  [
      add: fn() -> 1+2 end,
    hang1: fn() -> :timer.sleep(1000) end,
    hang2: fn() -> :timer.sleep(5000) end
  ]
  |> Enum.map(fn {k, t} ->
    {k, Task.async(t)}
  end)
  |> Enum.map(fn {k, t} ->
    {k, Task.await(t, :infinity)}
  end)


Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: