aboutsummaryrefslogtreecommitdiffhomepage
path: root/contrib/subtac/sutils.ml
blob: 64365b6763f3f91336c246acc465fe5a7eb113b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
let list_index x l =
  let rec aux i = function
      y :: tl -> if x = y then i else aux (succ i) tl
    | [] -> raise Not_found
  in aux 0 l

let list_assoc_index x l =
  let rec aux i = function
      (y, _) :: tl -> if x = y then i else aux (succ i) tl
    | [] -> raise Not_found
  in aux 0 l