On 2/10/07, Creighton Hogg <[EMAIL PROTECTED]> wrote:



On 2/10/07, Lennart Augustsson <[EMAIL PROTECTED]> wrote:
>
> There are many things that makes your code slow.
> * The default for Haskell is to compute with Integer, not Int.  So
> that makes from Integral and floor very slow.
> * foldl' is a bad choice, because it is too strict, you want to abort
> the loop as soon as possible.


Now why is foldl' too strict?  I don't think I understand?

I think I can explain my confusion better.  For a finite list, I thought a
fold would always pass through the entire list.  I take it that what you
mean is that, since the fold is over an &&, then it can bail as soon as it
encounters the first false, but it only does that if it's allowed to not be
strict.  I suppose this reveals my ignorance of how laziness really works.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to