Learn R Programming

tinylens (version 0.1.0)

index_l: Index lens

Description

Lens into a single element of a list.

Usage

index_l(i)

Value

A lens that selects the specified element

Arguments

i

Index of the element to lens into

Details

This lens performs indexing using double bracket notation, i.e., x[[i]].

Examples

Run this code
x <- list(a = 1, b = 2)
l <- index_l("a")
view(x, l)

Run the code above in your browser using DataLab