build_factory {factory} | R Documentation |
Easily Build Function Factories
build_factory(fun, ...)
fun |
An anonymous function to turn into a factory. |
... |
Arguments for the factory function. Things on the RHS will be
evaluated before building your factory unless explicitly quoted with
|
A function factory.
y <- 2
power <- build_factory(
fun = function(x) {
x^exponent
},
exponent
)
square <- power(y)
square(2)
y <- 7
square(2)