[Rd] Inspecting promises
Gabor Grothendieck
ggrothendieck at gmail.com
Mon Sep 24 03:31:01 CEST 2007
Is there some way of displaying the expression and evaluation environment
associated with a promise? I have found the following:
> # first run these two commands to set up example
> e <- new.env()
> delayedAssign("y", x*x, assign.env = e)
> # method 1. shows expression but not evaluation environment
> str(as.list(e))
List of 1
$ y: promise to language x * x
> # method 2. shows expression but not evaluation environment
> substitute(y, e)
x * x
which shows two different ways of displaying the expression
associated with a promise but neither shows the evaluation
environment. The first technique may actually be a bug in
R based on previous discussion on r-devel.
Is there a way to display both the expression and the evaluation
environment associated with a promise. Its a bit difficult to debug
code involving promises if you can't inspect the objects you are
working with.
> R.version.string # Vista
[1] "R version 2.6.0 beta (2007-09-19 r42914)"
More information about the R-devel
mailing list