Re: [Haskell] space behaviour of lazy recursive lists

2005-02-03 Thread Axel Jantsch
Hi, Both variants of the strict zipWith solved the gibs problem I posed: gibs = 1 : 1 : f gibs (tail gibs) where f (x:xs) (y:ys) = z `seq` z : f xs ys where z = min (x + y) 10 by Simon MArlow and zipWith' f (x:xs) (y:ys) = let z = f x y

Re: [Haskell] space behaviour of lazy recursive lists

2005-02-03 Thread Colin Runciman
Axel, ... However, they do not directly solve my problem in the bigger program which still has the same linearly growing memory requirement. The problem seems to be very, very hard to find. I suspect it is related to lazyness as in the gibs example, but I just cannot put my finger on the code that

RE: [Haskell] space behaviour of lazy recursive lists

2005-02-01 Thread Simon Marlow
On 30 January 2005 17:09, Ben Rudiak-Gould wrote: Axel Jantsch wrote: Consider: gibs = 1 : 1 : (zipWith f gibs (tail gibs)) where f x y = min (x + y) 10 [...] how can I force the garbage collector to reclaim the memory of the head of the list after I have processed it,

[Haskell] space behaviour of lazy recursive lists

2005-01-30 Thread Axel Jantsch
Hi, How can I get constant space behaviour for lazy, recursive streams? Consider: gibs = 1 : 1 : (zipWith f gibs (tail gibs)) where f x y = min (x + y) 10 This is derived from the fibs text book example, modified to bound the memory requirement for each list element. Evaluating gibs

Re: [Haskell] space behaviour of lazy recursive lists

2005-01-30 Thread Ben Rudiak-Gould
Axel Jantsch wrote: Consider: gibs = 1 : 1 : (zipWith f gibs (tail gibs)) where f x y = min (x + y) 10 [...] how can I force the garbage collector to reclaim the memory of the head of the list after I have processed it, since I will never ever reference it again? There's no entirely

Re: [Haskell] space behaviour of lazy recursive lists

2005-01-30 Thread karczma
Ben Rudiak-Gould writes: Axel Jantsch wrote: gibs = 1 : 1 : (zipWith f gibs (tail gibs)) where f x y = min (x + y) 10 [...] how can I force the garbage collector to reclaim the memory of the head of the list after I have processed it, since I will never ever reference it again?

Re: [Haskell] space behaviour of lazy recursive lists

2005-01-30 Thread Adrian Hey
On Sunday 30 Jan 2005 4:00 pm, Axel Jantsch wrote: Hi, How can I get constant space behaviour for lazy, recursive streams? Consider: gibs = 1 : 1 : (zipWith f gibs (tail gibs)) where f x y = min (x + y) 10 This is derived from the fibs text book example, modified to bound the