X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fextlib%2FhExtlib.ml;h=523913cbfcda4e6e2e501103d068d1462ff9232e;hb=916c558005ed665c62699a7a4c5347870c8a3efb;hp=e2063e451a692ccb25fa045de3f88b21c726a499;hpb=88381f8e48371c86d29eaeee8354ebfd651ab9e8;p=helm.git diff --git a/helm/software/components/extlib/hExtlib.ml b/helm/software/components/extlib/hExtlib.ml index e2063e451..523913cbf 100644 --- a/helm/software/components/extlib/hExtlib.ml +++ b/helm/software/components/extlib/hExtlib.ml @@ -239,14 +239,14 @@ let list_concat ?(sep = []) = aux [] let rec list_findopt f l = - let rec aux = function + let rec aux k = function | [] -> None | x::tl -> - (match f x with - | None -> aux tl + (match f x k with + | None -> aux (succ k) tl | Some _ as rc -> rc) in - aux l + aux 0 l let split_nth n l = let rec aux acc n l = @@ -464,7 +464,7 @@ let loc_of_floc floc = Stdpp.first_pos floc, Stdpp.last_pos floc;; let floc_of_loc (loc_begin, loc_end) = Stdpp.make_loc (loc_begin, loc_end) -let dummy_floc = floc_of_loc (-1, -1) +let dummy_floc = floc_of_loc (0, 0) let raise_localized_exception ~offset floc exn = let x, y = loc_of_floc floc in @@ -539,6 +539,7 @@ let rec mk_list x = function ;; let list_seq start stop = + if start > stop then [] else let rec aux pos = if pos = stop then [] else pos :: (aux (pos+1))