spacepaste

  1.  
  2. module SetFuns (OT: Map.OrderedType) (SBLE: STRINGABLE with type t = OT.t) =
  3. struct
  4. module S = Set.Make(OT)
  5. let of_list l = List.fold_right S.add l S.empty
  6. (* map from Set to Set of the same type. currying heaven. *)
  7. let map f s = S.fold (fun x -> S.add (f x)) s S.empty
  8. let ppr ff s =
  9. Format.fprintf ff "@[{";
  10. ppr_list_inners (
  11. fun ff x ->
  12. Format.fprintf ff "%s" (SBLE.to_string x);
  13. ) ff (S.elements s);
  14. Format.fprintf ff "}@]"
  15. end
  16.