search for: isparsetree

Displaying 1 result from an estimated 1 matches for "isparsetree".

2014 May 01
3
How to test if an object/argument is "parse tree" - without evaluating it?
...ariable/argument passed to a function is a "parse tree" for an (unevaluated) expression or not, *without* evaluating it if not? Currently, I do various rather ad hoc eval()+substitute() tricks for this that most likely only work under certain circumstances. Ideally, I'm looking for a isParseTree() function such that I can call: expr0 <- foo({ x <- 1 }) expr1 <- foo(expr0) stopifnot(identical(expr1, expr0)) where foo() is: foo <- function(expr) { if (!isParseTree(expr)) expr <- substitute(expr) expr } I also want to be able to do: expr2 <- foo(foo(foo(foo(expr...