f::iterate (public)

 f::iterate n f x

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

Examples: f::iterate 10 [f::lambda {x} {expr $x+1}] 5 = {5 6 7 8 9 10 11 12 13 14} f::iterate 10 [f::lambda {x} {expr $x*2}] 1 = {1 2 4 8 16 32 64 128 256 512} f::iterate 4 f::tail {1 2 3 4 5} = {{1 2 3 4 5} {2 3 4 5} {3 4 5} {4 5}}

Parameters:
n
f
x
Returns:
\{x (f x) (f (f x) (f (f (f x))) ...\}\}.

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

Testcases:
functional_api
Source code:
    set result {}
    for {set i 0} {$i<$n} {incr i} {
        lappend result $x
        set x [$f $x]
    }
    return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: