Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Producer Consumer Filter C S T in
- fun{Producer N}
- local F in
- fun{F Acc}
- if Acc == N then N|nil
- else Acc|{F Acc+1}
- end
- end
- {F 1}
- end
- end
- fun{Consumer S}
- local Cons in
- fun{Cons S Acc}
- case S of nil then Acc
- [] H|T then {Cons T Acc+H}
- else 'fuck you bitch'
- end
- end
- {Cons S 0}
- end
- end
- fun{Filter S}
- case S of nil then nil
- [] H|T then if (H mod 2)==0 then {Filter T}
- else H|{Filter T}
- end
- else 'fuck you bitch'
- end
- end
- thread S = {Producer 20} end
- thread T = {Filter S} end
- thread C = {Consumer T} end
- {Browse C}
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement