Hello,<br><br>I&#39;m quite new to Haskell, but this is my understanding... Please correct me if I am wrong, as there is a good chance I am.&nbsp; ;)<br><br>### Begin Code ###<br>module Main where<br><br>main =<br>&nbsp; putStrLn (show( (take 4 . map (&gt; 0)) (f s t) ))<br>
&nbsp; where<br>&nbsp;&nbsp;&nbsp; s = 2 : t<br>&nbsp;&nbsp;&nbsp; t = 3 : s<br>&nbsp;&nbsp;&nbsp; f = zipWith (-)<br>{-<br>&nbsp;- Output:<br>&nbsp;- *Main&gt; main<br>&nbsp;- [False,True,False,True]<br>&nbsp;-}<br>&nbsp;&nbsp;&nbsp; <br>{-&nbsp; <br>&nbsp;- (take 4 . map (&gt; 0)) (f s t)<br>&nbsp;- Evaluates the list for take until 4 elements have been reached.<br>
&nbsp;- Below I replaced (f s t) with the values to make the evaluation<br>&nbsp;- explicit.<br>&nbsp;-<br>&nbsp;- Evaluation:<br>&nbsp;-<br>&nbsp;- map (&gt; 0) (zipWith (-) [2 ..] [3 ..])<br>&nbsp;- False -- 1st element for take.<br>&nbsp;-<br>&nbsp;- map (&gt; 0) (zipWith (-) [3 ..] [2 ..])<br>
&nbsp;- True -- 2nd element for take.<br>&nbsp;-<br>&nbsp;- map (&gt; 0) (zipWith (-) [2 ..] [3 ..])<br>&nbsp;- False -- 3rd element for take.<br>&nbsp;-<br>&nbsp;- map (&gt; 0) (zipWith (-) [3 ..] [2 ..])<br>&nbsp;- True -- 4th element for take.<br>&nbsp;-}<br>
<br>-- EOF.<br>### End Code ###<br><br>Hope that helps.<br>__<br>Donnie Jones<br><br><br><div class="gmail_quote">On Fri, May 9, 2008 at 1:52 PM, PR Stanley &lt;<a href="mailto:prstanley@ntlworld.com">prstanley@ntlworld.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi<br>
&nbsp;(take 4 . map (&gt;0)) (f s t)<br>
&nbsp;where<br>
 &nbsp; &nbsp; &nbsp; &nbsp;s = 2 : t<br>
 &nbsp; &nbsp; &nbsp; &nbsp;t = 3 : s<br>
&nbsp;f = zipWith (-)<br>
What would be the order of evaluation for the above code? How would I illustrate the evaluation step-by-step?<br>
I&#39;m guessing that &nbsp;the code necessitates lazy evaluation and as such it starts with take then it applies f which in turn applies s and t and zipWith until the first element satisfies the predicate in map and This is repeated 4 times<br>

What does the list think?<br>
Many thanks,<br>
Paul<br>
P.S. I&#39;m not done with induction. I&#39;m just letting it rst for a bit.<br>
<br>
_______________________________________________<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>
</blockquote></div><br>