caparol6991

Untitled

Nov 18th, 2019
775
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. allocate({[], Allocated}, _Pid) ->
  2.     erlang:display(Allocated),
  3.     {{[], Allocated}, {error, no_frequency}};
  4. allocate({[Freq|Free], Allocated}, Pid) ->
  5.     erlang:display(Allocated),
  6.     {{Free, [{Freq, Pid}|Allocated]}, {ok, Freq}}.
  7. deallocate({Free, Allocated}, Freq) ->
  8.     NewAllocated=lists:keydelete(Freq, 1, Allocated),
  9.     {[Freq|Free], NewAllocated}.
RAW Paste Data