Stream Splitting Agent

{Split L Test L1 L2}: input stream L, output streams L1,L2 -- dispatch condition {Test M} (if true append to L1 else to L2)

In the Actors model, this is known as the receptionist pattern
proc {Split L Test L1 L2}
   P1 = {NewPort L1}
   P2 = {NewPort L2}
in
   thread
      for M in L do
         if {Test M} then {Send P1 M} else {Send P2 M} end
      end
   end
end