FunctionGenerator {tm} | R Documentation |
Constructs a function generator object.
## S4 method for signature 'function': FunctionGenerator(object)
object |
a generator function which takes some input and constructs and returns a new function based on that input information. |
An S4 object of class FunctionGenerator
which extends the class
function
representing a function generator.
Ingo Feinerer
Many reader functions are function generators, e.g.,
readPlain
.
funGen <- FunctionGenerator(function(y, ...) { if (is(y, "integer")) function(x) x+1 else function(x) x-1 }) funGen funGen(3L) funGen("a")