From: Amit D. <ami...@gm...> - 2005-09-09 11:16:31
|
Hi, I was surprised to find there is no findi function in ExtLib. I'm=20 considering adding: to extList.ml: let rec findi p l =3D let rec loop n =3D function | [] -> raise Not_found | h :: t -> if p n h then (n,h) else loop (n+1) t in loop 0 l to extList.mli: val findi : (int -> 'a -> bool) -> 'a list -> (int * 'a) (** [findi p e l] returns the first element [ai] of [l] along with its index [i] such that [p i ai] is true, or raises [Not_found] if no such element has been found. *) I still have CVS access, if there are no complaints, I will submit this in = a=20 couple days. |