]> matita.cs.unibo.it Git - fireball-separation.git/blobdiff - ocaml/parser.ml
Re-use Util.index_of
[fireball-separation.git] / ocaml / parser.ml
index 90cda05bd2313d661d51c009919eccdf9c1407cd..b496070b690e9077d6b482774f06d0a8ab1c776b 100644 (file)
@@ -14,17 +14,12 @@ let isAlphaNum c = let n = Char.code c in
  (48 <= n && n <= 90) || (95 <= n && n <= 122) ;;\r
 let isSpace c = c = ' ' || c = '\n' || c = '\t' ;;\r
 \r
-let rec index_of x =\r
-  function\r
-  | [] -> raise (Failure "index_of: Not Found")\r
-  | h::t -> if x = h then 0 else 1 + index_of x t\r
-;;\r
 (* FIXME *)\r
 let mk_var' (bound, free) x =\r
   if List.mem x bound\r
-  then free, mk_var (index_of x bound)\r
+  then free, mk_var (Util.index_of x bound)\r
   else if List.mem x free\r
-       then free, mk_var (List.length bound + index_of x free)\r
+       then free, mk_var (List.length bound + Util.index_of x free)\r
        else (free @ [x]), mk_var (List.length bound + List.length free)\r
 ;;\r
 \r