Created
November 5, 2015 14:22
-
-
Save MonkeyIsNull/3cb5afcb8cfe00c63f5c to your computer and use it in GitHub Desktop.
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
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