<br><br><div><span class="gmail_quote">On 15/09/06, <b class="gmail_sendername">Lennart Augustsson</b> <<a href="mailto:firstname.lastname@example.org">email@example.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Sep 14, 2006, at 03:05 , Rohan Drape wrote:<br><br>>>> splitStreams [(3,x),(1,y),(3,z),(2,w)]<br>>> [(3,[x,z]),(1,[y]),(2,[w])]<br>><br>> [snip]<br>><br>>> Furthermore it should work on infinite lists. It can't eat the whole
<br>>> list before producing any output.<br>><br>> This doesn't seem to make sense? Only at the end of the list can you<br>> know that you've collected all the events for each channel. If you<br>> output anything before scanning to the end, you'd not know if there
<br>> were perhaps more events on that channel?<br>It makes good sense. Each list will of events will be evaluated<br>lazily, so thing will appear there as they appear in the input.<br><br>I don't think you can do it in Haskell without some magic in the IO/
<br>ST monad.<br><br><br></blockquote></div><br>But even if you could do it, its very hard to safely /use/ the result.<br>Looking for the next event on any channel runs the risk that actually there<br>are no more events ever on that channel, and a resultant scan to the end of the infinite list!
<br clear="all"><br>-- <br>Brian_Brunswick____brian@ithil.org____Wit____Disclaimer____!Shortsig_rules!