[Haskell-cafe] multiple computations, same input

Tomasz Zielonka tomasz.zielonka at gmail.com
Tue Mar 28 01:02:34 EST 2006


On Mon, Mar 27, 2006 at 03:10:18PM -0800, Greg Fitzgerald wrote:
>  > hold a part of the data in memory while you show the first one,
> 
> Here would be a better example then.
> 
>     f lst = show (sum (filter (> 1) lst), sum (filter (> 2) lst))
> 
> It ought to be *possible* to compute both operations without holding onto
> any of the list elements.

I wonder if it would be possible to remove the space-leak by running both
branches concurrently, and scheduling threads in a way that would
minimise the space-leak. I proposed this before

  http://www.haskell.org/pipermail/haskell-cafe/2005-December/013428.html

I would like to hear opinions from some compiler gurus.

Best regards
Tomasz


More information about the Haskell-Cafe mailing list