Displaying 1 result from an estimated 1 matches for "sinnf".
Did you mean:
sinne
2004 Jun 07
1
Lazy Evaluation?
...nction(x) x^2
NF <- NumFunction(square)
setMethod("Math",
"NumFunction",
function(x){
nfun <- function(n) callGeneric(x at fun(n))
tmp <- function(n) nfun(n)
NumFunction(tmp)
})
sinNF <- sin(NF)
sinNF at fun(sqrt(pi/2))
# works as expected, returns 1
# now a slightly different version of setMethod("Math", "NumFunction",
# ...), which dispenses the "unnecessary" wrapper function tmp()
setMethod("Math",
"NumFunctio...