over_map {tinylens} | R Documentation |
Apply a function to each element of a list returned by a lens. Using over
in such cases would require a "lifted" function, which is often unergonomic.
over_map(d, l, f)
d |
The data structure to modify |
l |
The list-returning lens to apply |
f |
The function to apply to each element of the list |
The modified data structure
d <- list(list(a = 1, b = 2), list(a = 4, b = 9))
l <- map_l(index_l("a"))
over_map(d, l, sqrt)