Milos Hasan wrote:
import System.Random
import Data.List
randFloats :: [Float]
randFloats = randoms (mkStdGen 0)
main = print $ sum $ sort $ take 1000000 randFloats
Could it be that Data.List.sort is the culprit that uses O(n) stack
space here? If so, is this avoidable?
sum is not tail-recursive. Sometimes, GHCs strictness analyzer is able
to optimize that away.
Regards,
apfelmus
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe