Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (22 sloc) 499 Bytes
-module(fizzbuzz3).
-export([run/1]).
run(List) ->
Evaluator = spawn(fun() -> evaluate() end),
spawn(fun() -> iterate(List, Evaluator) end).
evaluate() ->
receive
{evaluate, Sender, N} ->
Sender ! {fizzbuzz, fizzbuzz:run(N)},
evaluate();
stop ->
ok
end.
iterate([], Evaluator) ->
Evaluator ! stop;
iterate([H | T], Evaluator) ->
Evaluator ! {evaluate, self(), H},
receive
{fizzbuzz, N} ->
io:format("~p~n", [N])
end,
iterate(T, Evaluator).