<br><br><div><span class="gmail_quote">On 15/09/06, <b class="gmail_sendername">Lennart Augustsson</b> &lt;<a href="mailto:lennart@augustsson.net">lennart@augustsson.net</a>&gt; 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>&gt;&gt;&gt; splitStreams [(3,x),(1,y),(3,z),(2,w)]<br>&gt;&gt; [(3,[x,z]),(1,[y]),(2,[w])]<br>&gt;<br>&gt; [snip]<br>&gt;<br>&gt;&gt; Furthermore it should work on infinite lists. It can't eat the whole
<br>&gt;&gt; list before producing any output.<br>&gt;<br>&gt; This doesn't seem to make sense?&nbsp;&nbsp;Only at the end of the list can you<br>&gt; know that you've collected all the events for each channel.&nbsp;&nbsp;If you<br>&gt; output anything before scanning to the end, you'd not know if there
<br>&gt; were perhaps more events on that channel?<br>It makes good sense.&nbsp;&nbsp;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!