the
filter
of
(
list ,
functionName )
filter
(
list ,
functionName )
List yields a list
. FunctionName yields the name of a function.
put filter((1,2,inf,NaN,-7), "isFinite") -- prints 1,2,-7
The filter
function applies the specified functionName to each item in the specified list and returns a list of the values for which the function returned true
. The function must return either true
or false
for each item in the list; otherwise, a script error will be triggered.