declare fun {NewPortObject Init Fun} Strm fun {Loop Msg|Msgs Lst} {Loop Msgs {Fun Lst Msg}} end in thread _ = {Loop Strm Init} end {NewPort Strm} end