On Mon, Jul 28, 2008 at 12:15 PM, Niels Aan de Brugh
<nielsadb@gmail.com> wrote:
Because you're not providing the right number. :-)
You know, I realized that this morning after I woke up....ha ha. Sometimes a good night's sleep is all it takes...
I've tested your code with strictness annotations and it appears to not make a difference. GHC employs several optimization techniques, one of those being strictness analysis, so maybe it is already using a strict, unboxed integer.
Ah. I figured that I probably didn't have to worry about it manually...
The real speed-up (a non-linear one) here is not to re-calculate every sequence over and over again, but keep it in a map/array (as suggested by Rafael and me). I've found some Euler puzzles are impossible to solve without this technique.
Niels
P.S.: If you're really going for speed, compile (not interpret) the code (using -O -fvia-C, and there's some more stuff in the manual) using the latest greatest version of GHC.