<div dir="ltr">On Sun, Aug 3, 2008 at 11:06 AM, Arie Groeneveld <span dir="ltr">&lt;<a href="mailto:bradypus@xs4all.nl">bradypus@xs4all.nl</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Sorry, should go the forum.<br>
<br>
Ok, thanks. In this case the list consists of 6-digit alphanumeric<br>
codes. So doing something like:<br>
<br>
foldl1 (\x y -&gt; g y) xs</blockquote><div><br>No, that still doesn&#39;t force elements.&nbsp; Let&#39;s say g is (+1):<br><br>f = \x y -&gt; (+1) y<br>foldl1 f [1,2,3]<br><br>(1 `f` 2) `f` 3<br>(+1) 3<br>4<br><br>So we don&#39;t need to compute (+1) on any numbers but 3.<br>
<br>The most direct way is to force the elements of the list:<br><br>import Control.Parallel.Strategies<br>seqList rwhnf (map g xs)<br><br>Note that the notion of &quot;compute&quot; in this example is to WHNF, so for example if g produces lists, it will only evaluate far enough to determine whether the list is a nil or a cons, not the whole thing.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
will do the job?<br>
<br>
<br>
=@@i<br>
<br>
<br>
Bulat Ziganshin schreef:<div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello Arie,<br>
<br>
Sunday, August 3, 2008, 1:56:43 PM, you wrote:<br>
<br>
*Main&gt;&gt; last . f $ xs<br>
<br>
this way you will get only &quot;spin&quot; of list computed, not elements<br>
itself. something like sum should be used instead<br>
<br>
<br>
 &nbsp;<br>
</blockquote>
<br></div><div><div></div><div class="Wj3C7c">
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div>