filter#
Filter items in a matrix.
Available in: math cells, REPL.
Syntax#
filter(x, test)
Arguments and behavior#
Pass an array and a predicate callback. Only entries whose predicate returns true are kept.
Example#
Edit the inputs, then use Run or Reset. Changes stay in this example.
Example
positive(x) = x > 0
filter([-1,2,3],positive)Interactive examples could not load. You can still copy the expressions.
Expected result: matrix.