Re: [Haskell-cafe] Re: Laziness leaks

2008-06-05 Thread Jules Bean
Achim Schneider wrote: You don't come across space-leaks in strict programs often because data is usually allocated statically even if execution is non-strict. Piping /dev/zero into a program that just sleeps does leak space, though. It only leaks 8K or whatever size your system buffers

Re: [Haskell-cafe] Re: Laziness leaks

2008-06-05 Thread Ketil Malde
Albert Y. C. Lai [EMAIL PROTECTED] writes: I haven't heard the terms laziness leak and strictness leak before Leak refers to a surprise. I the meaning of leak is in a bit of flux. Originally, I believe it refers to a memory leak, where the programmer forgot to call free() before losing the

Re: [Haskell-cafe] Re: Laziness leaks

2008-06-05 Thread Loup Vaillant
2008/6/4 apfelmus [EMAIL PROTECTED]: [...] But it can waste space (- space leak), for instance by accumulating a big expression like (..) - ((..)+1) - (((..) + 1) + 1) - etc. instead of evaluating x+1 immediately 5 - 6- 7- etc. So, it is called a space leak

[Haskell-cafe] Re: Laziness leaks

2008-06-05 Thread Achim Schneider
Jules Bean [EMAIL PROTECTED] wrote: Achim Schneider wrote: You don't come across space-leaks in strict programs often because data is usually allocated statically even if execution is non-strict. Piping /dev/zero into a program that just sleeps does leak space, though. It

[Haskell-cafe] Re: Laziness leaks

2008-06-05 Thread apfelmus
Ketil Malde wrote: I the meaning of leak is in a bit of flux. Originally, I believe it refers to a memory leak, where the programmer forgot to call free() before losing the pointer, thus making the program consume memory it can't recover, and can't use. With automatic memory management,

Re: [Haskell-cafe] Re: Laziness leaks

2008-06-05 Thread Paul Johnson
Achim Schneider wrote: There won't ever be a space leak without a time leak nor a time leak without a space leak. I'd just call it a leak. Actually I think you can have a space leak without a time leak. For instance if every time around the main loop I cons data onto a linked list that

[Haskell-cafe] Re: Laziness leaks

2008-06-05 Thread Achim Schneider
Paul Johnson [EMAIL PROTECTED] wrote: Achim Schneider wrote: There won't ever be a space leak without a time leak nor a time leak without a space leak. I'd just call it a leak. Actually I think you can have a space leak without a time leak. For instance if every time around the main

[Haskell-cafe] Re: Laziness leaks

2008-06-04 Thread apfelmus
Ronald Guida wrote: So I just thought of something. If laziness leads to laziness leaks, then is there such a thing as a strictness leak? I realized that the answer is yes. A lazy leak is a situation where I'm wasting resources to delay a sequence of calculations instead of just doing them

Re: [Haskell-cafe] Re: Laziness leaks

2008-06-04 Thread Albert Y. C. Lai
apfelmus wrote: I haven't heard the terms laziness leak and strictness leak before, imho they sound a bit spooky because it's not clear to me what the situation without leak would be. (Time vs Space? Is an O(n) algorithm a strictness leak compared to an O(log n) algorithm?) Leak refers to a

Re: [Haskell-cafe] Re: Laziness leaks

2008-06-04 Thread Ryan Ingram
On 6/4/08, apfelmus [EMAIL PROTECTED] wrote: Note that lazy evaluation never wastes time; evaluating a term with lazy evaluation will always take less reduction steps than doing so eagerly or partly eagerly. True, but you can still have a time leak; this is particularily relevant in

[Haskell-cafe] Re: Laziness leaks

2008-06-04 Thread Achim Schneider
Ryan Ingram [EMAIL PROTECTED] wrote: On 6/4/08, apfelmus [EMAIL PROTECTED] wrote: Note that lazy evaluation never wastes time; evaluating a term with lazy evaluation will always take less reduction steps than doing so eagerly or partly eagerly. True, but you can still have a time leak;