Displaying 1 result from an estimated 1 matches for "makefun3".
Did you mean:
makefun1
2008 Jan 21
2
experiments with slot functions and possible problems NOTE
...,
function() bar()
)
}
## 2c) or use an alternative way with a special function
## addtoenv, suggested by Gabor Grothendieck some times ago:
addtoenv <- function(L, p = parent.frame()) {
for(nm in names(L)) {
assign(nm, L[[nm]], p)
environment(p[[nm]]) <- p
}
L
}
makefun3 <- function(flist) {
addtoenv(flist)
function() bar()
}
## 3) now we create the "top-level" functions
## with one particular "set of functions"
m1 <- makefun1(flistA)
m2 <- makefun2(flistA)
m3 <- makefun3(flistA)
m1()
## this was no problem, trivial
m2()...