let rec all_vals = function | Empty -> [] | Full v -> [v] | Node l -> List.flatten (List.fold_left (fun acc (_,t) -> (all_vals t)::acc) [] l)