let to_list t =
    List.rev (fold (fun l b -> b::l) [] t)