Re: [Batteries-discuss] how to get an IntSet and a FloatSet with batteries
Francois Berenger <[email protected]>
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <[email protected]> |
On 01/06/2014 05:41 PM, Francois Berenger wrote:
> Hi,
>
> I currently use Set.Make but I guess there are already
> cooked alternatives.
>
> Additional bonus points: how to add the functions of_list and to_list to
> those sets?
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
> to_list should be an alias for elements
>
> Thanks a lot,
> F.
> _______________________________________________
> Batteries-discuss mailing list
> [email protected]
> https://lists.forge.ocamlcore.org/cgi-bin/listinfo/batteries-discuss
--
Best regards,
Francois Berenger.