From ross at biostat.ucsf.edu  Fri Feb 16 22:36:57 2007
From: ross at biostat.ucsf.edu (Ross Boylan)
Date: Fri, 16 Feb 2007 13:36:57 -0800
Subject: [Rd] R Language Manual: possible error
Message-ID: <1171661817.9347.86.camel@iron.psg.net>

The R Language manual, section 4.3.4 ("Scope"), has
     f <- function(x) {
         y <- 10
         g <- function(x) x + y
         return(g)
     }
     h <- f()
     h(3)
  
... When `h(3)' is evaluated we see that its body is that of `g'.
Within that body `x' and `y' are unbound.

Is that last sentence right?  It looks to me as if x is a bound
variable, and the definitions given in the elided material seem to say
so too.  I guess there is hidden, outer, x that is unbound.  Maybe the
example was meant to be 
	g <- function(a) a + y?

The front page of the manual says
 The current version of this document is 2.4.0 (2006-11-25) DRAFT.
-- 
Ross Boylan                                      wk:  (415) 514-8146
185 Berry St #5700                               ross at biostat.ucsf.edu
Dept of Epidemiology and Biostatistics           fax: (415) 514-8150
University of California, San Francisco
San Francisco, CA 94107-1739                     hm:  (415) 550-1062



[Rd] R Language Manual: possible error
Ross Boylan