17 Jan
2003
17 Jan
'03
4:36 p.m.
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
8624
Age (days ago)
8624
Last active (days ago)
0 comments
1 participants
participants (1)
-
Kim-Ee Yeoh