struct
module M = Map.Make (struct type t = const let compare = compare_const end)
include M
exception Choose of const * int
let choose m =
try
M.iter (fun c i -> raise (Choose (c, i))) m;
raise Not_found
with Choose (c, i) -> c, i
let is_num m =
if M.cardinal m = 1 then
match choose m with
| (ConstInt n | ConstReal n), i -> Some (Num.mult_num (Num.Int i) n)
| _ -> None
else None
end