
Arie,
foldl1 is not strict in its function argument. Using it will cause stack overflows for large lists.
For example:
GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help
Loading package base ... linking ... done.
Prelude> foldl1 (+) [0..1000000]
*** Exception: stack overflow
foldl1' from Data.List is strict in its function argument, and is probably what you want.
See also http://www.haskell.org/haskellwiki/Stack_overflow.
Regards,
Brad Larsen
On Sun, 03 Aug 2008 07:06:40 -0400, Arie Groeneveld
Sorry, should go the forum.
Ok, thanks. In this case the list consists of 6-digit alphanumeric codes. So doing something like:
foldl1 (\x y -> g y) xs
will do the job?
=@@i
Bulat Ziganshin schreef:
Hello Arie,
Sunday, August 3, 2008, 1:56:43 PM, you wrote:
*Main>> last . f $ xs
this way you will get only "spin" of list computed, not elements itself. something like sum should be used instead
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe