X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=inline;f=helm%2Focaml%2Fmathql_interpreter%2FmQIUtil.ml;h=8d5782deaf4c66160f627c938c32f574328f334f;hb=efdc3184ccd0738fe48aa0056fc444fba23329e8;hp=67df606d18741e0058f8bb682d14cfef08abccf2;hpb=9cbce40d56958c466459b028cf250441ec29c9fe;p=helm.git diff --git a/helm/ocaml/mathql_interpreter/mQIUtil.ml b/helm/ocaml/mathql_interpreter/mQIUtil.ml index 67df606d1..8d5782dea 100644 --- a/helm/ocaml/mathql_interpreter/mQIUtil.ml +++ b/helm/ocaml/mathql_interpreter/mQIUtil.ml @@ -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)