Displaying 1 result from an estimated 1 matches for "makefun2".
Did you mean:
makefun1
2008 Jan 21
2
experiments with slot functions and possible problems NOTE
...on() {
1:10
},
bar = function() {
log(foo())
}
)
## .. we may also have alternative sets,
## e.g. flistB, flistC, ... etc
## 2) Now we try to construct closures
## 2a) non-nested
makefun1 <- function(flist) {
with(flist,
function() foo()
)
}
## 2b) nested call
makefun2 <- function(flist) {
with(flist,
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)
envi...