let rec sigma f l = match l with | [] -> 0 | x :: rest -> f x + sigma f rest;;