Loading ...
Sorry, an error occurred while loading the content.

13992Re: "ocaml_beginners"::[] Re: [Batteries-discuss] how to get an IntSet and a FloatSet with batteries

Expand Messages
  • rixed
    Jan 6, 2014
      -[ Mon, Jan 06, 2014 at 05:54:15PM +0900, Francois Berenger ]----
      > I have this currently but I feel it is too long:
      >
      > module IntSet = struct
      > include Set.Make(
      > struct type t = int
      > let compare = cmp_int
      > end)
      > (* extend type with more operations *)
      > let of_list = L.fold_left (fun acc x -> add x acc) empty
      > let to_list = elements
      > end

      Why not use BatInt itself as the OrderedType?

      module IntSet = struct
      include Set.Make(BatInt)
      (* extend type with more operations *)
      ...
      end
    • Show all 7 messages in this topic