where_il {tinylens}R Documentation

Predicate ilens

Description

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

Usage

where_il(p)

Arguments

p

A predicate function

Value

A lens that selects the elements that satisfy the predicate

Examples

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

[Package tinylens version 0.1.0 Index]