From ggrothendieck at gmail.com  Mon Sep 24 03:31:01 2007
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Sun, 23 Sep 2007 21:31:01 -0400
Subject: [Rd] Inspecting promises
Message-ID: <971536df0709231831p52ef05cax5e5e66390b3bacee@mail.gmail.com>

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)"



[Rd] Inspecting promises
Gabor Grothendieck