let union_map f = function
    | [] -> List []
    | d::ds ->
        List.fold_left
          (fun w x -> union_data w (f x))
          (f d) ds