Re: [Haskell-cafe] Profiling help (Warning: Euler spoilers)

2010-03-04 Thread Daniel Fischer
Am Donnerstag 04 März 2010 16:07:51 schrieb Louis Wasserman: Actually, looking back, I'm not sure mapM is even the right choice. I think foldM would suffice. All we're doing is finding the association pair with the minimum key, no? In this case, foldM would do everything we need to...and

[Haskell-cafe] Profiling help (Warning: Euler spoilers)

2010-03-03 Thread James Jackson
I have written the program below, which solves problem 14 from Project Euler, which asks us to find the hailstone number below 1 million that takes the longest to get to 1. The program solves the problem using dynamic programming using a Data.Map. It completes in under a minute (barely), but

[Haskell-cafe] Profiling help (Warning: Euler spoilers)

2010-03-03 Thread Louis Wasserman
James, Which version of Control.Monad.State are you importing? If you're just importing vanilla Control.Monad.State, that's actually sending you to Control.Monad.State.Lazy. Using Control.Monad.State.Strict might solve your problems, srsly. Laziness can result in epically failing memory leaks.