fold1

EveAndersson.com : API Browser : fold1

fold1

fold1 f xs
Defined in tcl/ad-functional.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

  • fold1 min [list 3 1 4 1 5 9 2 6] = 1
  • fold1 max [list 3 1 4 1 5 9 2 6] = 9

Parameters:
f
xs
[ show source ]

Show another procedure:

eve@eveandersson.com