build_factory {factory}R Documentation

Easily Build Function Factories

Description

Easily Build Function Factories

Usage

build_factory(fun, ...)

Arguments

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 quote. See examples.

Value

A function factory.

Examples

y <- 2
power <- build_factory(
  fun = function(x) {
    x^exponent
  },
  exponent
)
square <- power(y)
square(2)
y <- 7
square(2)

[Package factory version 0.1.0 Index]