over_map {tinylens}R Documentation

Map a function over a list lens

Description

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.

Usage

over_map(d, l, f)

Arguments

d

The data structure to modify

l

The list-returning lens to apply

f

The function to apply to each element of the list

Value

The modified data structure

Examples

d <- list(list(a = 1, b = 2), list(a = 4, b = 9))
l <- map_l(index_l("a"))
over_map(d, l, sqrt)

[Package tinylens version 0.1.0 Index]