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 &quot;strong&quot; form of this problem.
<br><br><div><span class="gmail_quote">On 10/13/06, <b class="gmail_sendername">Silviu Gheorghe</b> &lt;<a href="mailto:ghesil.lists@gmail.com">ghesil.lists@gmail.com</a>&gt; 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 &lt;-[0..5000000]]
<br>and use &quot;slowFunctionCacheList !! i&quot; instead of &quot;slowFunction (i)&quot;<br><br>it helped alot (i mean i stoped the program after &quot;3 hours still working&quot; 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> &lt;<a href="mailto:rootbeer@redcat.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rootbeer@redcat.com</a>&gt; 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 &lt;<a href="mailto:ghesil.lists@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ghesil.lists@gmail.com</a>&gt; wrote:<br><br>&gt; I'd like to know if the results are &quot;cached&quot;&nbsp;&nbsp;by the compiler
<br><br>Hardly ever, as I understand things.
<br><br>&gt; if they are not I'd like to know what is the best way to cache them<br>&gt; manually, and where can I read more about this, and the optimizations the<br>&gt; compiler does, because I've searched the web before and i found very little
<br>&gt; on this topic.<br><br>You need to search for the word &quot;memoize&quot; (or &quot;memoise&quot;). Here's a<br>page about a memo function for GHC.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<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>