Re: role of seq, $!, and bangpatterns illuminated with lazy versus strict folds Re: [Haskell-cafe] What is the role of $!?

2007-12-10 Thread Albert Y. C. Lai
Thomas Hartman wrote: -- (myfoldl f q ) is a curried function that takes a list -- If I understand currectly, in this "lazy" fold, this curried function isn't applied immediately, because -- by default the value of q is still a thunk myfoldl f z [] = z myfoldl f z (x:xs) = ( myfoldl f q ) xs

role of seq, $!, and bangpatterns illuminated with lazy versus strict folds Re: [Haskell-cafe] What is the role of $!?

2007-12-10 Thread Thomas Hartman
rather than ask the role of $! I found it helpful to first grasp the role of seq, since $! is defined in terms of seq and seq is a "primitive" operation (no prelude definition, like with IO, it's a "given"). What helped me grasp seq was its role in a strict fold. Basically, try to sum all the n