it does, thank you very much for the quick answer, unfortunately as I understand it, it doesn't work well on ints :(

for just now i created a list

slowFunctionCacheList= [slowFunction (i) | i <-[0..5000000]]
and use "slowFunctionCacheList !! i" instead of "slowFunction (i)"

it helped alot (i mean i stoped the program after "3 hours still working" and got the result in 2 minutes :))

i am still curious about a better method (and a general one), because this is ugly, and it only works on ints as i see it.

but then again thank you for telling me it doesn't do it, because i had the false impresion it does and i wouldn't stop it otherwise

On 10/13/06, Tom Phoenix <[EMAIL PROTECTED]> wrote:
On 10/12/06, Silviu Gheorghe <[EMAIL PROTECTED]> wrote:

> I'd like to know if the results are "cached"  by the compiler

Hardly ever, as I understand things.

> if they are not I'd like to know what is the best way to cache them
> manually, and where can I read more about this, and the optimizations the
> compiler does, because I've searched the web before and i found very little
> on this topic.

You need to search for the word "memoize" (or "memoise"). Here's a
page about a memo function for GHC.

     http://www.haskell.org/ghc/docs/6.4.2/html/hslibs/memo-library.html

Hope this helps!

--Tom Phoenix

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to