]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/mathql_interpreter/mQIUtil.ml
standard library and while construction inserted
[helm.git] / helm / ocaml / mathql_interpreter / mQIUtil.ml
index d0e127c6410f7fb37f5da78489a593581098ce2b..8d5782deaf4c66160f627c938c32f574328f334f 100644 (file)
@@ -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)