thank you for all the answers<br>i was aware lists are is not the best solution, but i was too keen to see the actual result <br><br>I'll do some tests though using different variants, because i have the feeling that in my next program I'll face the "strong" form of this problem.
<br><br><div><span class="gmail_quote">On 10/13/06, <b class="gmail_sendername">Silviu Gheorghe</b> <<a href="mailto:ghesil.lists@gmail.com">ghesil.lists@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
it does, thank you very much for the quick answer, unfortunately as I understand it, it doesn't work well on ints :(<br><br>for just now i created a list <br><br>slowFunctionCacheList= [slowFunction (i) | i <-[0..5000000]]
<br>and use "slowFunctionCacheList !! i" instead of "slowFunction (i)"<br><br>it helped alot (i mean i stoped the program after "3 hours still working" and got the result in 2 minutes :))<br>
<br>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.<br><br>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
<div><span class="e" id="q_10e3ea34962f0c1e_1"><br><br><div><span class="gmail_quote">On 10/13/06, <b class="gmail_sendername">Tom Phoenix</b> <<a href="mailto:rootbeer@redcat.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rootbeer@redcat.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 10/12/06, Silviu Gheorghe <<a href="mailto:ghesil.lists@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ghesil.lists@gmail.com</a>> wrote:<br><br>> I'd like to know if the results are "cached" by the compiler
<br><br>Hardly ever, as I understand things.
<br><br>> if they are not I'd like to know what is the best way to cache them<br>> manually, and where can I read more about this, and the optimizations the<br>> compiler does, because I've searched the web before and i found very little
<br>> on this topic.<br><br>You need to search for the word "memoize" (or "memoise"). Here's a<br>page about a memo function for GHC.<br><br> <a href="http://www.haskell.org/ghc/docs/6.4.2/html/hslibs/memo-library.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.haskell.org/ghc/docs/6.4.2/html/hslibs/memo-library.html</a><br><br>Hope this helps!<br><br>--Tom Phoenix<br></blockquote></div><br>
</span></div></blockquote></div><br>