Skip to content
Prev 66753 / 398525 Next

Recall() and sapply()

On Wed, 30 Mar 2005, Robin Hankin wrote:

            
You can't use Recall here. I thought this was explicitly documented, but 
it turns out that it isn't, an omission I will fix.


You don't need Recall, because R can easily have recursive functions 
without it (unlike S)
- as you show in f1, the function can call itself
- the problem with f1 is that it stops working if you change the name, but
   ?local shows how to get around this. This is probably the best way to
   implement recursion.
- You can even implement Y, the "appplicative-order fixed point operator"
   to create anonymous recursive functions a la lambda calculus.


 	-thomas