]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/mathql_interpreter/mQIUtil.ml
update
[helm.git] / helm / ocaml / mathql_interpreter / mQIUtil.ml
index 67df606d18741e0058f8bb682d14cfef08abccf2..8d5782deaf4c66160f627c938c32f574328f334f 100644 (file)
@@ -30,7 +30,7 @@
 
 let mql_false = []
 
-let mql_true = [("", [])]
+let mql_true = ["", []]
 
 (* set theoretic operations *************************************************)
 
@@ -128,3 +128,13 @@ let xor v1 v2 =
    let b = v1 <> mql_false in 
    if b && v2 <> mql_false then mql_false else
    if b then v1 else v2
+
+(* numeric operations *******************************************************)
+
+exception NumberError of MathQL.result
+
+let int_of_set r =
+   try match r with 
+      | [s, _] -> MQueryUtil.int_of_string s
+      | _      -> raise (Failure "int_of_string")
+   with Failure "int_of_string" -> raise (NumberError r)