Displaying 1 result from an estimated 1 matches for "isentrypoint".
Did you mean:
entrypoint
2013 Feb 17
1
detecting entry into a recursive function
Given a function that calls itself, what's the best way to detect the
entry point? The best I came up with is:
IsEntryPoint <- function(){
par <- sys.call(-1L)[[1]]
grandpar <- sys.call(-2L)[[1]]
!identical(par, grandpar)
}
but this won't work for functions that don't directly call themselves;
for example, in this one the paste gets inserted in the call stack, so i
is always TRUE....