Recall                 package:base                 R Documentation

_R_e_c_u_r_s_i_v_e _C_a_l_l_i_n_g

_D_e_s_c_r_i_p_t_i_o_n:

     'Recall' is used as a placeholder for the name of the function in
     which it is called.  It allows the definition of recursive
     functions which still work after being renamed, see example below.

_U_s_a_g_e:

     Recall(...)

_A_r_g_u_m_e_n_t_s:

     ...: all the arguments to be passed.

_N_o_t_e:

     'Recall' will not work correctly when passed as a function
     argument, eg to the 'apply' family of functions.

_S_e_e _A_l_s_o:

     'do.call' and 'call'.

     'local' for another way to write anonymous recursive functions

_E_x_a_m_p_l_e_s:

     ## A trivial (but inefficient!) example:
     fib <- function(n) if(n<=2) {if(n>=0) 1 else 0} else Recall(n-1) + Recall(n-2)
     fibonacci <- fib; rm(fib)
     ## renaming wouldn't work without Recall
     fibonacci(10) # 55

