let rec fold (oper : int -> int -> int) (x0 : int) f x =
match x with
| [] -> x0
| h :: rest -> oper (f h) (fold oper x0 f rest);;
let fold (oper : int -> int -> int) (x0 : int) f =
let rec aux x =
match x with
| [] -> x0
| h :: rest -> oper (f h) (aux rest) in
aux;;
let sigma f l = fold ( + ) 0 f l;;
let pi f l = fold ( * ) 1 f l;; |