[R] Recall for parent

Paul Roebuck roebuck at mdanderson.org
Wed Mar 29 21:46:08 CEST 2006


What's the best way to simulate Recall for parent function?
Consider this one-time recursive code:

alwaysEven <- function(x) {
    handleOdd <- function(x) {
        alwaysEven(x-1)    # use Recall-like here
    }

    return(if (x %% 2) handleOdd(x) else x)
}
any2even <- alwaysEven
rm(alwaysEven)
any2even(3)

----------------------------------------------------------
SIGSIG -- signature too long (core dumped)




More information about the R-help mailing list