Skip to main content

Vector.filter

filterfilter

Group: Selections
Aliases: where

Documentation

Selects all elements of this vector which satisfy a condition.

Arguments

  • filter: The filter to apply to the vector. It can either be an instance of Filter_Condition or a predicate taking a value and returning a boolean value indicating whether the corresponding element should be kept or not.

Examples

Selecting all elements that are greater than 3.

      [1, 2, 3, 4, 5].filter (> 3)
[1, 2, 3, 4, 5].filter (..Greater than=3)