f::fold (public)

 f::fold f e xs

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

Takes a binary function f, a start element e and a list {x1 x2 ...} and returns f (...(f (f (f e x1) x2) x3)...). Examples: f::fold + 0 [list 1 2 3 4] = 10 f::fold * 1 [list 1 2 3 4] = 24

Parameters:
f (required)
e (required)
xs (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_functional_api functional_api (test acs-tcl) f::fold f::fold test_functional_api->f::fold f::and f::and (public) f::and->f::fold f::choose f::choose (public) f::choose->f::fold f::fold1 f::fold1 (public) f::fold1->f::fold f::or f::or (public) f::or->f::fold f::product f::product (public) f::product->f::fold

Testcases:
functional_api
Source code:
    set result $e
    foreach x $xs {
        set result [$f $result $x]
    }
    return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: