Mark Tullsen wrote:
>
> You have to realize that Alastair Reid is one of the truly
> great Haskell programmers on planet earth. I'm serious.
> So, when he says "incredibly subtle space leak" I wouldn't
> expect the solution to be simple.
Whoops. Now don't I feel foolish.
> As far as I can tell, your argument would also apply to foo2,
> which doesn't have a space leak.
Hmmm... Let's see.
foo2 m
= take m v
where
v = 1 : flatten (map single v)
single x = [x]
v = 1 : flatten (map single v)
= 1 : flatten (map single (1 : flatten (map single v)))
= 1 : flatten (single 1 : map single (flatten (map single v)))
= 1 : flatten ([1] : map single (flatten (map single v)))
= 1 : 1 : flatten (map single (flatten (map single v)))
= Aaaarrggggh! You're right.
Now don't I feel double foolish. :P
Okay, then, what is the *right* way to reason about these things?
Cheers,
Tom
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
- Re: Why is there a space leak here? Tom Moertel
- Re: Why is there a space leak here? Claus Reinke
- Re: Why is there a space leak here? S. Alexander Jacobson
- Re: Why is there a space leak here? Wojciech Moczydlowski, Jr
- Re: Why is there a space leak here? Tom Moertel
- Re: Why is there a space leak here? Wojciech Moczydlowski, Jr
- Re: Why is there a space leak here? Mark Tullsen
- Re: Why is there a space leak here? Alastair David Reid
- Re: Why is there a space leak here? Steinitz, Dominic J
- Re: Why is there a space leak here? Mark Tullsen
- Re: Why is there a space leak here? Tom Moertel
- Re: Why is there a space leak here? Mark Tullsen
- Re: Why is there a space leak here? Claus Reinke
- Re: Why is there a space leak here? J�rgen Gustavsson
- Re: Why is there a space leak here? Carl R. Witty
- Re: Why is there a space leak here? S. Alexander Jacobson
- Re: Why is there a space leak here? Juan Carlos Arevalo Baeza
- Re: Why is there a space leak here? Carl R. Witty
