[Haskell-cafe] Lazy evaluation and tail-recursion

Tillmann Rendel rendel at informatik.uni-marburg.de
Thu Mar 17 13:05:33 CET 2011


Hi,

Daniel Fischer wrote:
>> Let's look at the following code:
>>
>>     countdown n = if n == 0 then 0 else foo (n - 1)
>
> s/foo/countdown/
>
> presumably
>
>>
>>     if' c t e = if c then t else e
>>     countdown' n = if' (n == 0) 0 (foo (n - 1))
>
> s/foo/countdown'/

Yes to both substitutions. Looks like I need an email client with ghc 
integration.

   Tillmann



More information about the Haskell-Cafe mailing list