select function
The elements of a list for which a test holds.
How to write it
select(list, test)
- list
- The list. Takes a list.
- test
- A function that is true or false for an element. Takes a function.
Examples
select([1, 2, 3, 4], x => x > 2)In the solver,
Open in the solverselect([1, 2, 3, 4], x => x > 2)gives[3, 4].
Related functions
- sort
A list in increasing order.
- rotate_right
A list with its elements moved to the right, the last ones going to the front.
- subsets
All the sublists of a list that keep its order, as a list.
- rotate_left
A list with its elements moved to the left, the first ones going to the end.
- table
Build a list by evaluating an expression over one or more ranges.
- riffle
A list with a value put between its elements.