X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fextlib%2FhExtlib.ml;h=99e6609ec27efed198c8ba68bfa34f0f6b069199;hb=9d4a3a25b327bb2c15bd0cff116ba6698b1a4335;hp=a0f9d8d6cbb1ab0295b65035f873c724e6668d5d;hpb=0ac236dda6f80f6dc86a7f12d8c88b25e64e3251;p=helm.git diff --git a/helm/ocaml/extlib/hExtlib.ml b/helm/ocaml/extlib/hExtlib.ml index a0f9d8d6c..99e6609ec 100644 --- a/helm/ocaml/extlib/hExtlib.ml +++ b/helm/ocaml/extlib/hExtlib.ml @@ -134,6 +134,16 @@ let list_concat ?(sep = []) = | hd :: tl -> aux ([sep; hd] @ acc) tl in aux [] + +let rec list_findopt f l = + let rec aux = function + | [] -> None + | x::tl -> + (match f x with + | None -> aux tl + | Some _ as rc -> rc) + in + aux l (** {2 File predicates} *)