Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Oz 0.76 KB | None | 0 0
  1. local Producer Consumer Filter C S T in
  2. fun{Producer N}
  3.         local F in
  4.             fun{F Acc}
  5.                 if Acc == N then N|nil
  6.                 else Acc|{F Acc+1}
  7.                 end
  8.             end
  9.             {F 1}
  10.         end
  11.     end
  12. fun{Consumer S}
  13.     local Cons in
  14.         fun{Cons S Acc}
  15.                 case S of nil then Acc
  16.                 [] H|T then {Cons T Acc+H}
  17.                 else 'fuck you bitch'
  18.             end
  19.         end
  20.         {Cons S 0}
  21.     end
  22. end
  23. fun{Filter S}
  24.     case S of nil then nil
  25.     [] H|T then if (H mod 2)==0 then {Filter T}
  26.                 else H|{Filter T}
  27.                 end
  28.     else 'fuck you bitch'
  29.     end
  30. end
  31. thread S = {Producer 20} end
  32. thread T = {Filter S} end
  33. thread C = {Consumer T} end
  34. {Browse C}
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement