let export_and_clear tbl build acc =
  let acc = Hashtbl.fold (fun id e acc -> (build id e)::acc) tbl acc in
    Hashtbl.clear tbl;
    acc