[Haskell-beginners] recursive 'let' ?
Kim-Ee Yeoh
ky3 at atamo.com
Tue Apr 15 00:57:19 UTC 2014
On Mon, Apr 14, 2014 at 11:24 AM, John M. Dlugosz
<ngnr63q02 at sneakemail.com>wrote:
> I don't mind recursive *functions*. It's recursive definition of single
>> computed values that looked odd to me. Lazy evaluation makes all the
>> difference. Looking at
>> b= f a c
>>
>> c = f a b
>> I was thinking, "how can it figure out what b and c need to be?" because
>> I'm used to this meaning that it needs to come up with an actual value
>> right now.
>>
>>
To amplify Arjun's point,
b = f a c
c = f a b
is equivalent to
b = f a (f a b)
c = f a (f a c)
and now the mutual recursion that's troubling John vanishes.
They become plain ol' self-recursive functions.
I don't think mutual recursion is harder to make sense of than
self-recursion. I think self-recursion appears easier than mutual
recursion, but that's deceptive. It's actually just as hard!
>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140415/1e86fd18/attachment.html>
More information about the Beginners
mailing list