I'm trying to build a recursive set of functions that take a set of arguments, change some of the arguments and recursively call the same (or different) function.
For example here's a stupid recursive counting function that prints back all integers from x to 0 (and ignores arguments y and z) cnt <- function(x, y, z) { stopifnot(is.numeric(x)) print (x) recursionFUN <- match.call() recursionFUN$x <- x - 1 if (x <= 0) { invisible(TRUE) } else { eval(recursionFUN) } } My problem is that sometimes I want to set one of the arguments to NULL. But trying to set one of the match.call() arguments to NULL causes it to be ignored (since the match.call() output is coerced into a list). What I'd like is that the match.call() output could be converted into an alist, so that tagged values with no arguments could be handled and passed on to the next function call without being ignored. However, I haven't been able to figure out how to construct this alist without knowing ahead of time what all of the function arguments are and typing them in explicitly: e.g. alist(x = 5, y = 2, z = 3). Re-assigning and then re-evaluating output of the match.call() function might not be the way to go, but I am not sure, and would appreciate any comments on the best way to set function arguments to NULL before evaluating. Thanks, Robert Robert McGehee Geode Capital Management, LLC 53 State Street, 5th Floor | Boston, MA | 02109 Tel: 617/392-8396 Fax:617/476-6389 mailto:[EMAIL PROTECTED] This e-mail, and any attachments hereto, are intended for us...{{dropped}} ______________________________________________ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel