Create a getter
lens from a function.
to_l(f)
f | The function to promote. |
---|
# This wouldn't make sense as a general legal lens, but fine as a `getter` sqrt_l <- to_l(sqrt) iris_root <- index(1) %.% index(1) %.% sqrt_l sqrt(iris[[1]][[1]])#> [1] 2.258318#> [1] 2.258318#> [1] "See, can't do that"