Skip to content

Instantly share code, notes, and snippets.

@JakubOboza
Created July 27, 2011 23:03
Show Gist options
  • Save JakubOboza/1110554 to your computer and use it in GitHub Desktop.
Save JakubOboza/1110554 to your computer and use it in GitHub Desktop.
reduceF(ProcCount, Results) ->
receive
{emit, Ref, Value } -> reduceF(ProcCount, [Value | Results]);
{spawn, Ref } -> reduceF(ProcCount + 1, Results);
{die, Ref } -> Count = ProcCount - 1,
if
Count =:= 0 -> Results;
true -> reduceF(Count, Results)
end
after
1000 -> ok
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment