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

  • fold + 0 [list 1 2 3 4] = 10
  • fold * 1 [list 1 2 3 4] = 24

Parameters:
f
e
xs

Partial Call Graph (max 5 caller/called nodes):
%3 f::and f::and (public) f::fold f::fold f::and->f::fold f::choose f::choose (public, deprecated) 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:
No testcase defined.
[ show source ]
Show another procedure: