Sorry for the french, I was a little bit confused...<br><br><div><span class="gmail_quote">On 08/02/08, <b class="gmail_sendername">Chaddaï Fouché</b> &lt;<a href="mailto:chaddai.fouche@gmail.com">chaddai.fouche@gmail.com</a>&gt; wrote :<br>
After I changed John&#39;s code so that it worked on the same dataset as mine, I could benchmark both of them :<br>My solution is a bit faster (but that&#39;s a very tiny difference and to be expected since John&#39;s fold are more general than mine), but in any case, both solution are reasonably fast (2s on a 10M Double array (unboxed)) and don&#39;t eat any more memory than necessary :<br>
<br>Anyway it would be nice to have some version of those function in the standard library (MArray) since they are pretty useful and efficient. I don&#39;t use functional language in order to have to code explicit loops on my data structures !! ;-)<br>
(And as we saw, to write an <span style="font-weight: bold;">efficient</span> generalisation of those loops isn&#39;t as easy as it might seems)<br><br>-- <br>Jedaï<br></span></div><br>