Leverages makeActiveBinding() by allowing parametrized functions that take the name of the binding and an arbitrary number of additional arguments.

create_env(names, fun, ..., .envir = parent.frame(),
.enclos = parent.frame())

populate_env(env, names, fun, ..., .envir = parent.frame())

## Arguments

names
A name, or a list of names, or a character vector; in the latter case the names are mangled if they are not representable in the native encoding
fun
A function with at least one argument, which will be called to compute the value of a binding. The function will be called with the binding name as first argument (unnamed), and ... as additional arguments
...
Additional arguments to fun
.envir
The environment in which fun will be executed, important if fun calls other functions that are not globally visible
.enclos
The enclosing environment (parent.env) for the newly created environment
env
An environment

## Examples

env <- create_env(letters, paste0, "-lowercase")
env$a#> [1] "a-lowercase"env$c#> [1] "c-lowercase"env$Z#> NULLpopulate_env(env, LETTERS, paste0, "-uppercase") env$a#> [1] "a-lowercase"env\$Z#> [1] "Z-uppercase"