On 20/11/2013, at 12:27 PM, srean wrote:
>
> Stringing things into a pipeline is so much easier to do with coroutines, I
> think the above is a short example to show that.
You mean like this?
~/felix>less test/regress/rt/pipe-01.flx
// Pipe test.
proc source (cho:oschannel[int]) {
for var i in 0 upto 9 do write (cho,i); done
}
proc sink (chi:ischannel[int]) {
while true do var x= read chi; println x; done
}
proc xduce(chi: ischannel[int], cho: oschannel[int]) {
write (cho, 99);
while true do var x = read chi; write (cho, x); write (cho, 2 * x); done
}
spawn_fthread$ source |-> xduce |-> sink;
--
john skaller
[email protected]
http://felix-lang.org
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language