On Mon, Apr 14, 2014 at 11:24 AM, John M. Dlugosz <ngnr63q02@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@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners