Loading

LFILTER

lists

The LFILTER function filters the element of a LIST according to the result of a macro execution on each element of the LIST. It produces a LIST containing only the elements for which the macro returned true.

The macro is called with a stack containing the LIST index on top and the element at that particular index below it. You can override this behaviour with a boolean.

LFILTER is available since version 2.9.0.

See also

Signatures

Examples

[ 42 21 11 ] <% DROP 2 % 0 == %> //ignore the index, keep even elements LFILTER

Examples

A = [ 42, 21, 11 ] M = (v,i) -> { //ignore the index return v % 2 == 0 // keep even elements } return LFILTER(A, M)