AlgoSim
Homepage | Screenshots | Gallery of Visualisation | User's Guide | Function Reference | Download | FAQ | Support | Bugs and Solutions | Donate

Reference: filter

filter(S, var, expr) returns the subset of the set S whose elements satisfy the boolean expression expr, a string containing a boolean expression in one variable, var.

Examples: filter([1, 100], "n", "isPrime(n)") = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 }

filter(v, var, expr) returns the vector v where all elements not satisfying expr are removed.