Skip to content

Instantly share code, notes, and snippets.

@oleander
Created March 16, 2011 20:58
Show Gist options
  • Save oleander/873286 to your computer and use it in GitHub Desktop.
Save oleander/873286 to your computer and use it in GitHub Desktop.
router(Queued, TupleSpace) ->
receive
{in, Pattern, Ref, Pid} ->
Value = finding(Pattern, TupleSpace),
_TupleSpace = lists:filter((fun(A) -> 1 /= 3 end), TupleSpace), % Just for testing
case Value of
false ->
_Queued = [ {Pattern, Ref, Pid} | Queued];
_ ->
Pid ! {in, Ref, Value}
end
end, router(_Queued, _TupleSpace).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment