A newbie question: In Hugs, why does "maximum $ replicate n 0"
require space linear in n whereas "sum $ replicate n 0" appears
to have no such limit (in the sense that we don't get "ERROR - 
Garbage collection fails to reclaim sufficient space")?

The standard prelude defines both as basically foldl's -- maximum
is actually foldl1 max, so I'm a little confused here.

GHCi appears to require linear space for sum as well.

I guess the real question to ask is: is there a constant space version
of maximum, perhaps using strictness annotations?


Regards,
Kim-Ee


_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to