isClosure                package:nws                R Documentation

_D_e_t_e_r_m_i_n_e _i_f _a _W_o_r_k_e_r _F_u_n_c_t_i_o_n _i_s _a _C_l_o_s_u_r_e

_D_e_s_c_r_i_p_t_i_o_n:

     This is a heuristic function that is used by 'eachWorker' and 
     'eachElem' to guess if the worker function is a closure.

_D_e_t_a_i_l_s:

     If the 'closure' option wasn't specified via the 'eo' argument to
     'eachWorker' or 'eachElem', then this function is used to guess if
     the worker function is a closure.  It can be very useful to use
     closures with 'eachWorker' and 'eachElem', but if not used
     properly, you could accidentally include a lot of unnecessary data
     in the tasks, thus hurting your performance.

     This function is included as a development tool so you can
     manually test your worker functions.  This could be useful if you
     are getting a warning from 'eachWorker' or 'eachElem', and are
     trying to determine how to modify the function or set the
     'closure' option.

_E_x_a_m_p_l_e_s:

     # this should return FALSE
     isClosure(sqrt)
     f <- function(x) function(y) x + y
     g <- f(1)
     # this should return TRUE
     isClosure(g)

