bquote_fun_list.Rd
Backquote a list of functions
bquote_fun_list(fun_list)
List of functions
## Evaluate a list of functions
f1 <- function(x){x + 1}
f2 <- function(x){x + 8}
f1_ <- set_default(f1, list(x=10))
f2_ <- set_default(f2, list(x=10))
f1_(); f2_()
#> [1] 11
#> [1] 18
fn_list <- list(f1_, f2_)
fn_list_ <- bquote_fun_list(fn_list)
eval(fn_list[[1]]) ## No
#> function (x = 10)
#> {
#> x + 1
#> }
#> <environment: 0x56d101534da0>
sapply(fn_list, eval) ## No
#> [[1]]
#> function (x = 10)
#> {
#> x + 1
#> }
#> <environment: 0x56d101534da0>
#>
#> [[2]]
#> function (x = 10)
#> {
#> x + 8
#> }
#> <environment: 0x56d101534da0>
#>
eval(fn_list_[[1]]) ## Yes
#> [1] 11
sapply(fn_list_, eval) ## Yes
#> [1] 11 18