f::scanl (public)

 f::scanl 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 {e (f e x1) (f (f e x1) x2) ...}. Example: scanl + 0 [list 1 2 3 4] = {0 1 3 6 10} scanl * 1 [list 1 2 3 4] = {1 1 2 6 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::scanl f::scanl test_functional_api->f::scanl f::products f::products (public) f::products->f::scanl f::scanl1 f::scanl1 (public) f::scanl1->f::scanl f::sums f::sums (public) f::sums->f::scanl

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