📅  最后修改于: 2022-03-11 14:58:12.244000             🧑  作者: Mango
type 'a tree =
| Node of 'a tree * 'a * 'a tree
| Leaf;;
let rec fold_tree f a t =
match t with
| Leaf -> a
| Node (l, x, r) -> f x (fold_tree f a l) (fold_tree f a r);;