Strictness making it worst?

2001-11-29 Thread Tom Pledger
Jorge Adriano writes: : | Then I thought I'd mess with the fibonnaci function. | I began with: | | > fibac :: IntPos -> (IntPos,IntPos) -> (IntPos,IntPos) | > fibac n (a,b) | > | n == 0= (a,b) | > | otherwise = fibac (n-1) (b,a+b) |

Re: Strictness making it worst?

2001-11-29 Thread Jorge Adriano
> Then I tried: > > sfibac :: IntPos -> (IntPos,IntPos) -> > > (IntPos,IntPos) sfibac n (a,b) > > > >| n == 0= (a,b) > >| otherwise = sfibac (n-1) (b, (+b) $! a) I'm sorry I meant: > sfibac :: IntPos -> (IntPos,IntPos

Strictness making it worst?

2001-11-29 Thread Jorge Adriano
Hi, I've just started messing around with strictness. My goal now is understanding when and how to use it. I began with simple examples like making a strict foldl. When trying to sum a list of 6 elements with lazy foldl I'd get a stack space overflow, with a strict foldl I was able to sum