On Sun, Feb 24, 2013 at 6:31 AM, Martin Drautzburg <martin.drautzb...@web.de
> wrote:

> Just a silly quick question: why isn't right-recursion a similar problem?
>

Very roughly:

Left recursion is:  let foo n = n + foo n in ...
Right recursion is:  let foo 1 = 1; foo n = n + foo (n - 1) in ...

In short, matching the tokens before the right recursion will constitute an
end condition that will stop infinite recursion --- if only because you'll
hit the end of the input.   Left recursion doesn't consume anything, just
re-executes itself.

-- 
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to