u-facafichciiiheihbb 1 week ago 你这个是LAZY的，跟FOLD不一样。
u-facafichciiiheihbb 1 week ago 我是说你以前的一个FOLD表达式我跑不出来。
u-facafichciiiheihbb 1 week ago 你这是递归的，严格计算可以，FOLD这个TRUNK不好搞。
u-egi 1 week ago On my workstation running GHC 7.10.2, foldl' (\a e -> (mod e 10)*a) 1 [1..10^7] has a compiled run-time of 422 ms (all of it calculation) and allocates over 400 MBytes on the heap. Conversely, foldr (\e a -> (mod e 10)*a) 1 [1..10^7]
has a compiled run-time of 2203 ms (the same 422 ms calculation time
and 1781 ms of garbage collection) and allocates more than 550 MBytes on
the heap. That is what you should expect from reading the previous
sections; foldr will build up a huge stack of nested expression before evaluating the result and that stack needs to be garbage collected.
u-facafichciiiheihbb 1 week ago Prelude Data.List> fst $ foldl (\(!x,!y) !z -> (y, x+z)) (0,1) [1..10^8]
cabal: repl failed for fake-package-0. The build process was killed (i.e.
SIGKILL). The typical reason for this is that there is not enough memory
available (e.g. the OS killed a process using lots of memory).