Hi!

I know, that recursive functions fill the stack.
I learnt about right recursiveness.
Eg. the fib function:

fib0 n, acc
  if n>0
    fib0 n-1, n*acc
  else
    acc
  end
end

def fib n
  fib0 n, 1
end

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?

Gergo

+-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
|         Email: kgergely / mcl.hu,  kgergely / turul.eet.bme.hu          |
|  URL:   turul.eet.bme.hu/~kgergely    Mobile: (+36 20) 356 9656     |
+-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+
.
Magyar php mirror es magyar php dokumentacio: http://hu.php.net