ronggui <[EMAIL PROTECTED]> writes:

> In this case the environment contains the variables local to the
> function, and its enclosure is the environment of the enclosing
> function.(R-lang:p11)

Page number are of dubious value for documents in multiple formats. It
is page 5 in the PDF version on CRAN!

> 
> I want to know if the "enclosing function" means the closure of the
> function? for example ,if I call function mean(),and the create an
> environment,say e1,then the enclosure of e1 is the namespace of base
> package? Right?

No. A closure of a function is the function plus its environment. 

For "enclosing function", consider

f <- function() {
        print(environment())
        hello <- "Hi, babe!"
        g <- function() print(hello)
        g
}
myfun <- f() 
myfun()
environment(myfun)


The enclosing function of g, and hence of myfun, is f. The evaluation
environment of g has the evaluation environment of f as its enclosure. 

(The text is arguably imprecise: "evaluation environment of the
enclosing function call" would be better, especially since
environment(f) is something different.)

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to