f::fold1 (public)

 f::fold1 f xs

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

Takes a binary function f and a list {x1 x2 x3 ...} and returns (...(f (f (f x1 x2) x3) x4)...). "fold1" behaves like "fold", but does not take a start element and does not work for empty lists. Examples: f::fold1 min [list 3 1 4 1 5 9 2 6] = 1 f::fold1 max [list 3 1 4 1 5 9 2 6] = 9

Parameters:
f (required)
xs (required)
See Also:
  • fold1

Testcases:
functional_api
[ show source ]
Show another procedure: