Displaying 3 results from an estimated 3 matches for "my_do_unquote".
2017 Mar 17
2
Support for user defined unary functions
Your example
x = 5
exp = parse(text="f(uq(x)) + y +z") # expression: f(uq(x)) +y + z
do_unquote(expr)
# -> the language object f(5) + y + z
could be done with the following wrapper for bquote
my_do_unquote <- function(language, envir = parent.frame()) {
if (is.expression(language)) {
# bquote does not go into expressions, only calls
as.expression(lapply(language, my_do_unquote))
} else {
do.call(bquote, list(language, where=envir))
}
}
as in
>...
2017 Mar 17
0
Support for user defined unary functions
...Dunlap <wdunlap at tibco.com> wrote:
> Your example
> x = 5
> exp = parse(text="f(uq(x)) + y +z") # expression: f(uq(x)) +y + z
> do_unquote(expr)
> # -> the language object f(5) + y + z
> could be done with the following wrapper for bquote
> my_do_unquote <- function(language, envir = parent.frame()) {
> if (is.expression(language)) {
> # bquote does not go into expressions, only calls
> as.expression(lapply(language, my_do_unquote))
> } else {
> do.call(bquote, list(language, where=envir))
&g...
2017 Mar 17
2
Support for user defined unary functions
>After off list discussions with Jonathan Carrol and with
>Michael Lawrence I think it's doable, unambiguous,
>and even imo pretty intuitive for an "unquote" operator.
For those of us who are not CS/Lisp mavens, what is an
"unquote" operator? Can you expression quoting and unquoting
in R syntax and show a few examples where is is useful,
intuitive, and fits in to