[R] speeding up a recursive function

Thomas Lumley tlumley at u.washington.edu
Sun Apr 2 23:35:27 CEST 2006

On Sun, 2 Apr 2006, Gabor Grothendieck wrote:

> Some functional languages have a feature called tail recursion that
> can provide performance improvements if you write your recursions
> to take advantage of it:
>   http://en.wikipedia.org/wiki/Tail_recursion
> but I don't think R supports it.  Is this likely to become available
> in R?

No.  For a start, this is usually done by compilers, which we don't got.

In addition, it would be very difficult to do tail recursion optimization 
and not break most of the sys.* functions, which give explicit access to 
all the frames that would be optimized away.


More information about the R-help mailing list