X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Flambda-delta%2Flib%2Fcps.ml;h=3875d88fab91461a4965aceb438f2a73af906c87;hb=939f76e2fd4a50fd49c010a64e49b5625569d712;hp=9fc5dc9b22285d1f62a08090b845fe1b4e7b110d;hpb=338e3e5c639fbcfeeb347a0121cacc6c0f1fc42a;p=helm.git diff --git a/helm/software/lambda-delta/lib/cps.ml b/helm/software/lambda-delta/lib/cps.ml index 9fc5dc9b2..3875d88fa 100644 --- a/helm/software/lambda-delta/lib/cps.ml +++ b/helm/software/lambda-delta/lib/cps.ml @@ -30,10 +30,10 @@ let rec list_rev_map_append f map ~tail = function let f hd = list_rev_map_append f map ~tail:(hd :: tail) tl in map f hd -let rec forall2 f map l1 l2 = match l1, l2 with +let rec list_forall2 f map l1 l2 = match l1, l2 with | [], [] -> f true | hd1 :: tl1, hd2 :: tl2 -> - let f b = if b then forall2 f map tl1 tl2 else f false in + let f b = if b then list_forall2 f map tl1 tl2 else f false in map f hd1 hd2 | _ -> f false @@ -56,3 +56,10 @@ let list_map f = let list_iter f map l = let map f () x = map f x in list_fold_left f map () l + +let rec list_fold_left2 f map a l1 l2 = match l1, l2 with + | [], [] -> f a + | hd1 :: tl1, hd2 :: tl2 -> + let f a = list_fold_left2 f map a tl1 tl2 in + map f a hd1 hd2 + | _ -> assert false