Displaying 1 result from an estimated 1 matches for "makefun1".
Did you mean:
makefun2
2008 Jan 21
2
experiments with slot functions and possible problems NOTE
...==============
## 1) One possible "set of functions"
flistA <- list(
foo = function() {
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 <-...