X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Fsoftware%2Fcomponents%2Fextlib%2FhExtlib.ml;h=6af86f9cd4d4ac0b620d004976ea6a83fc951a6e;hb=abc5b4352a4ad787ede7122e2239ee44132886dd;hp=cdf26c5c7d2af6bf082a3a7b4e22b6b166ed45b4;hpb=d7d60e0067d067769b72b3d8d4b16fdae441c991;p=helm.git diff --git a/helm/software/components/extlib/hExtlib.ml b/helm/software/components/extlib/hExtlib.ml index cdf26c5c7..6af86f9cd 100644 --- a/helm/software/components/extlib/hExtlib.ml +++ b/helm/software/components/extlib/hExtlib.ml @@ -148,6 +148,22 @@ let list_mapi f l = aux 0 l ;; +let rec list_iter_default2 f l1 def l2 = + match l1,l2 with + | [], _ -> () + | a::ta, b::tb -> f a b; list_iter_default2 f ta def tb + | a::ta, [] -> f a def; list_iter_default2 f ta def [] +;; + +let rec list_forall_default3 f l1 l2 def l3 = + match l1,l2,l3 with + | [], [], _ -> true + | [], _, _ + | _, [], _ -> raise (Invalid_argument "list_forall_default3") + | a::ta, b::tb, c::tc -> f a b c && list_forall_default3 f ta tb def tc + | a::ta, b::tb, [] -> f a b def && list_forall_default3 f ta tb def [] +;; + let sharing_map f l = let unchanged = ref true in let rec aux b = function @@ -499,3 +515,24 @@ let chop_prefix prefix s = let touch s = try close_out(open_out s) with Sys_error _ -> () ;; + +let rec mk_list x = function + | 0 -> [] + | n -> x :: mk_list x (n-1) +;; + +let list_seq start stop = + let rec aux pos = + if pos = stop then [] + else pos :: (aux (pos+1)) + in + aux start +;; + +let rec list_skip n l = + match n,l with + | 0,_ -> l + | n,_::l -> list_skip (n-1) l + | _, [] -> assert false +;; +