From: Claudio Sacerdoti Coen Date: Sat, 25 Apr 2009 20:28:07 +0000 (+0000) Subject: Type for list_index improved. X-Git-Tag: make_still_working~4052 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=9bb529b1b6620f1cbb249104ef9303b130acb315;p=helm.git Type for list_index improved. --- diff --git a/helm/software/components/extlib/hExtlib.ml b/helm/software/components/extlib/hExtlib.ml index 523913cbf..3ef795e9f 100644 --- a/helm/software/components/extlib/hExtlib.ml +++ b/helm/software/components/extlib/hExtlib.ml @@ -148,6 +148,16 @@ let list_mapi f l = aux 0 l ;; +let list_index p = + let rec aux n = + function + [] -> None + | he::_ when p he -> Some (n,he) + | _::tl -> aux (n + 1) tl + in + aux 0 +;; + let rec list_iter_default2 f l1 def l2 = match l1,l2 with | [], _ -> ()