where
Filters list elements based on a predicate.
where(xs:list, capture:field, predicate:bool) -> list
Description
Section titled “Description”The where
function keeps only elements of a list for which a predicate
evaluates to true
.
xs: list
Section titled “xs: list”A list of values.
capture: field
Section titled “capture: field”The name of each list element in each predicate.
predicate: bool
Section titled “predicate: bool”The predicate evaluated for each list element.
Examples
Section titled “Examples”Keep only elements greater than 3
Section titled “Keep only elements greater than 3”from { xs: [1, 2, 3, 4, 5]}xs = xs.where(x, x > 3)
{xs: [4, 5]}