I know, that recursive functions fill the stack.
I learnt about right recursiveness.
Eg. the fib function:
fib0 n, acc
fib0 n-1, n*acc
def fib n
fib0 n, 1
The main advantage of the right recursion, that after the fib0 call,
there is nothing, so no need for stack space.
But this is just theory.
The right-recursive version stops execution because of stack overflow.
Will ruby detect this case and support right-recursion?
±[Kontra, Gergely @ Budapest University of Technology and Economics]-+
Email: email@example.com, firstname.lastname@example.org |