filterList (Function)
Signature: filterList(list: List<t0>, predicate: (t0) -> bool) -> List<t0>
Description: Returns a new list keeping the elements that satisfy a predicate, in index order.
Parameters
- list (
List<t0>): The list - predicate (
(t0) -> bool): The predicate that returns true for elements to keep
Returns: List<t0>
Example
let evens = filterList([1, 2, 3, 4], fn(n) => n % 2 == 0) // [2, 4]
evens = filterList ([1, 2, 3, 4], \n => n % 2 == 0) // [2, 4]