Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec simple_string_of_boolean_expression =
- function
- | Var i -> string_of_int i
- | Not (Var i) -> "¬" ^ string_of_int i
- | Not e -> "¬(" ^ (simple_string_of_boolean_expression e) ^ ")"
- | BinOp (l, o, r) -> (
- match l with
- | BinOp (_, lo, _) when lo <> o ->
- "(" ^ simple_string_of_boolean_expression l ^ ")"
- | _ -> simple_string_of_boolean_expression l
- ) ^ (string_of_binary_operator o) ^ (
- match r with
- | BinOp (_, ro, _) when ro <> o ->
- "(" ^ simple_string_of_boolean_expression r ^ ")"
- | _ -> simple_string_of_boolean_expression r
- )
- ;;
Advertisement
Add Comment
Please, Sign In to add comment