Compose two lenses to produce a new lens which represents
focussing first with the first lens, then with the second.
A view
using the resulting composite lens will first view
using
the first, then the second, while an set
will view
via the first lens,
set
into the resulting piece with the second, and then replace the
updated structure in the first with set
. Lens composition
is analogous to the .
syntax of object-oriented programming or to
a flipped version of function composition.
l %.% m
l | |
---|---|
m | the second lens |
#> [1] 4#> $b #> [1] 3 1 5 #>lst # returns list(b = c(3,4,5))#> $b #> [1] 3 4 5 #>