Skip to content

Instantly share code, notes, and snippets.

@MonkeyIsNull
Created November 5, 2015 14:22
Show Gist options
  • Save MonkeyIsNull/3cb5afcb8cfe00c63f5c to your computer and use it in GitHub Desktop.
Save MonkeyIsNull/3cb5afcb8cfe00c63f5c to your computer and use it in GitHub Desktop.
defmodule Fr do
def read_file(f) do
File.read!(f)
end
def to_s(num) do
Integer.to_string(num)
end
def read_five do
Enum.map(1..5, fn(x) -> Task.async(Fr, :read_file, ["/tmp/t" <> to_s(x)]) end)
end
def looper([]) do
end
def looper([h|t]) do
IO.inspect Task.await(h)
looper(t)
end
def run() do
looper(read_five())
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment