% $Id: MakeStreamObject.oz,v 1.1 2007/10/31 21:23:52 leavens Exp leavens $ %% Based on page 266 of CTM (but with different names) declare fun {MakeStreamObject NextState} proc {StreamObject InStream1 State1 ?OutStrm1} case InStream1 of InVal|InStream2 then local OutVal State2 OutStrm2 in {NextState InVal State1 OutVal State2} OutStrm1 = OutVal|OutStrm2 {StreamObject InStream2 State2 OutStrm2} end [] nil then OutStrm1=nil end end in %% receive on InStream0, output on OutStrm0 proc {$ InStream0 State0 ?OutStrm0} {StreamObject InStream0 State0 OutStrm0} end end