map_l: Promote a lens to apply to each element of a list

Description Usage Arguments Details Examples

Description

Create a new lens that views and sets each element of the list.

Usage

1
map_l(l)

Arguments

l

the lens to promote

Details

Uses lapply under the hood for view and mapply under the hood for set. This means that set can be given a list of values to set, one for each element. If the input or update are lists this lens always returns a list. If the input and update are vectors this lens will return a vector.

Examples

1
2
3
(ex <- replicate(10, sample(1:5), simplify = FALSE))
view(ex, map_l(index(1)))
set(ex, map_l(index(1)), 11:20)

lenses documentation built on May 2, 2019, 8:51 a.m.