(* To compare two “'a tree”s *) type 'a tree = NodeTree of ('a tree * 'a tree) | LeafTree of 'a;; let eq a b = let bel b x y = let rec g c = c<>[] & (let (a, b)::q = c in (a==x & b==y) or g q) in g b in let rec e h a b = ((bel h a b) or (match a, b with LeafTree x, LeafTree y -> x=y | NodeTree (g, f), NodeTree (c, d) -> let p = e ((a, b)::h) in (p g c & p f d) | _ -> 2<1)) in e [] a b in let rec a = NodeTree (NodeTree(a, LeafTree 3), a) in let rec b = NodeTree (b, NodeTree(LeafTree 3, b)) in print_int (if eq (NodeTree(LeafTree 3, a)) b then 1 else 0);;