Open hadley opened 8 months ago
To avoid this problem:
library(rlang) power1 <- function(exp) { inject(function(x) x ^ !!exp) } funs <- lapply(1:2, power1) funs #> [[1]] #> function(x) x ^ !!exp #> <environment: 0x107033e08> #> #> [[2]] #> function(x) x ^ !!exp #> <environment: 0x107032ba8> lapply(funs, \(f) structure(f, srcref= NULL)) #> [[1]] #> function (x) #> x^1L #> <environment: 0x107033e08> #> #> [[2]] #> function (x) #> x^2L #> <environment: 0x107032ba8>
Created on 2023-11-02 with reprex v2.0.2
To avoid this problem:
Created on 2023-11-02 with reprex v2.0.2