let prim1 (prim: string) (r: rslt)
: rslt =
begin match (prim, r) with
| ("!", Bool_value(bl)) -> Bool_value(not bl)
| ("-", Int_value(n)) -> Int_value(- n)
| ("typeof", Null_value) -> Type_value(Null_type)
| ("typeof", Bool_value(_)) -> Type_value(Bool_type)
| ("typeof", Int_value(_)) -> Type_value(Int_type)
| ("typeof", String_value(_)) -> Type_value(String_type)
| ("typeof", Url_value(_)) -> Type_value(Url_type)
| ("typeof", Type_value(_)) -> Type_value(Type_type)
| ("typeof", Code_value(_)) -> Type_value(Code_type)
| ("typeof", Win_value(_)) -> Type_value(Window_type)
| ("typeof", Node_value(_)) -> Type_value(Node_type)
| ("typeof", Closure(_)) -> Type_value(Function_type)
| ("StringToInt", String_value(s)) -> Int_value(int_of_string(s))
| ("IntToString", Int_value(i)) -> String_value(string_of_int(i))
| (_, (Error(_) as r)) -> r
| (_, _) ->
Error (
"primitive operation (" ^ prim ^ ") is not implemented on this type")
end