Name

filter — Filters a List

Synopsis

list filter ( any VAR ,
  list LIST ,
  block<boolean> EXPR );
 

Parameters

any VAR

Variable

list LIST

List to be filtered

block<boolean> EXPR

Block

Return

list

Description

For each element of the list LIST the expression expr is executed in a new block, where the variable VAR is assigned to that value. If the expression evaluates to true under this circumstances, the value is appended to the result list.

Usage

  filter (integer v, [1, 2, 3, 5], { return (v > 2); }) -> [3, 5]