[Haskell-cafe] Optimization problem
lennart at augustsson.net
Fri Sep 15 08:04:33 EDT 2006
I agree, the function can be tricky to use. But that's not our
problem, we are only to implement it. :)
On Sep 15, 2006, at 05:28 , Brian Brunswick wrote:
> On 15/09/06, Lennart Augustsson <lennart at augustsson.net> wrote: On
> Sep 14, 2006, at 03:05 , Rohan Drape wrote:
> >>> splitStreams [(3,x),(1,y),(3,z),(2,w)]
> >> [(3,[x,z]),(1,[y]),(2,[w])]
> > [snip]
> >> Furthermore it should work on infinite lists. It can't eat the
> >> list before producing any output.
> > This doesn't seem to make sense? Only at the end of the list can
> > know that you've collected all the events for each channel. If you
> > output anything before scanning to the end, you'd not know if there
> > were perhaps more events on that channel?
> It makes good sense. Each list will of events will be evaluated
> lazily, so thing will appear there as they appear in the input.
> I don't think you can do it in Haskell without some magic in the IO/
> ST monad.
> But even if you could do it, its very hard to safely /use/ the result.
> Looking for the next event on any channel runs the risk that
> actually there
> are no more events ever on that channel, and a resultant scan to
> the end of the infinite list!
> Brian_Brunswick____brian at ithil.org____Wit____Disclaimer____!
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe