[Haskell-cafe] Order of Evaluation

PR Stanley prstanley at ntlworld.com
Fri May 9 16:37:02 EDT 2008


>>Hi
>>(take 4 . map (>0)) (f s t)
>>where
>>         s = 2 : t
>>         t = 3 : s
>>f = zipWith (-)
>>What would be the order of evaluation for the above code? How would
>>I illustrate the evaluation step-by-step?
>
>What do you need it for, really? Pure functional programs are not
>about evaluation order, but about values.
         Paul: It actually comes from an old test. The question 
provides the code, asks for the evaluation of the code and then asks
" You should show your working at each stage of the calculation."

This isn't a straightforward top-to-bottom calculation that you can 
carry out in the style demonstrated frequently in the Hutton book. - 
{apply bla bla }
So I'm wondering how else it can be done.
Many thanks
Paul



More information about the Haskell-Cafe mailing list