Answers for "fold_tree ocaml"

0

fold_tree ocaml

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);;
Posted by: Guest on January-01-2021

Browse Popular Code Answers by Language