f::filter (public)

 f::filter pred xs

Defined in packages/acs-tcl/tcl/ad-functional-procs.tcl

Returns all elements of the list xs that fulfill the predicate pred.

Examples

  • filter even_p {3 1 4 1 5 9 2 6} = {4 2 6}
  • filter [lambda {x} {expr $x>500}] {317 826 912 318} = {826 912}

Parameters:
pred
xs

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.
Source code:
    set result {}
    foreach x $xs {
        if { [$pred $x] } {
            lappend result $x
        }
    }
    return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: