let apply a m =
  map (fun y -> try Map.find y m with Not_found -> y) a