let rec plus(n,m) = if n=0 then m else plus(m,n-1)+1;; let rec fois(m,n)= if m=0 || n=0 then 0 else if n=1 then m else fois(n,m-1)+n;; let rec somme_list l = if l=[] then 0 else plus(hd(l),somme_list(tl(l)));; let rec produit_list l = if l=[] then 1 else fois(hd(l),produit_list(tl(l)));; let accumule(depart, op_binaire) = let rec f l= if l=[] then depart else op_binaire(hd(l),f(tl(l))) in f;; # accumule(0,plus)([1;2;3;4]);; - : int = 10 let colle (a,b)=a@b;; let colle_toutes =accumule([],(fonction (a,b)->a@b));; # colle_toutes([[1;2;3;4];[5;6;7;8]]);; - : int list = [1; 2; 3; 4; 5; 6; 7; 8]