Displaying 4 results from an estimated 4 matches for "do_unquot".
Did you mean:
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(l...
2017 Mar 17
0
Support for user defined unary functions
...is
used for something else there, but again that's conjecture on my part.
Best,
~G
On Fri, Mar 17, 2017 at 12:53 PM, William 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
>...
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
2017 Mar 17
0
Support for user defined unary functions
...interpolation) is essentially
substituting part of an unevaluated expression with its evaluated value
inlined. The unquote operator, then, is the way of marking which parts of
the expression should be substituted in that way (i.e. interpolated).
i.e. if uq() is the unquote "operator" and do_unquote interpolates, then if
we have
x = 5
exp = parse(text="f(uq(x)) + y +z") # expression: f(uq(x)) +y + z
Then do_unquote would give you the *expression* f(5) + y + z
In terms of what it does that the tilde does not, it would give you the
ability to partially evaluate the captured formu...