Skip to content

filter_values

Syntax

filter_values(<list-expression>, "<operator>", <numeric-expression>)

Parameters

list-expression
An expression that evaluates to a list of items to filter.
operator
A mathematical operator, one of <, <=, =, ==, >, >=, or !=, surrounded by quotes.
numeric-expression
An expression that evaluated to a number to use as the comparison.

Returns

Returns a list with the values that satisfy the test of the given operator against the expression.

Description

Returns the list of the values in the given list expression that satisfy the given comparison formed by the given operator and numeric expression. For example, this might be used to determine the set of friends older than the current agent. This action is useful to determine the subset of a list that meets a given criteria.

Examples

The following results in new_list equal to list(10,8,6):

old_list = list(2,10,8,4,6)
new_list = filter_values(old_list, ">=", old_list[0] + 4)

See Also