Learn R Programming

tinylens (version 0.1.0)

where_il: Predicate ilens

Description

Illegal lens into elements of a vector that satisfy a predicate.

Usage

where_il(p)

Value

A lens that selects the elements that satisfy the predicate

Arguments

p

A predicate function

Examples

Run this code
d <- 1:10
l <- where_il(\(x) x %% 2 == 0)
view(d, l)
over(d, l, \(x) x / 2)

Run the code above in your browser using DataLab