树1
> type BinTree<'a, 'b> =
| Leaf of 'a
| Node of BinTree<'a, 'b> * 'b * BinTree<'a, 'b>;;
type BinTree<'a,'b> =
| Leaf of 'a
| Node of BinTree<'a,'b> * 'b * BinTree<'a,'b>
> let t1 = Node(Node(Leaf 1, "cd", Leaf 2), "ab", Leaf 3);;
val t1 : BinTree<int,string> = Node (Node (Leaf 1,"cd",Leaf 2),"ab",Leaf 3)
> let rec depth = function
| Leaf _ -> 0
| Node (t1, _, t2) -> 1 + max (depth t1) (depth t2);;
val depth : _arg1:BinTree<'a,'b> -> int
> depth t1;;
val it : int = 2