1MoreLabels.Set(3)                OCaml library               MoreLabels.Set(3)
2
3
4

NAME

6       MoreLabels.Set - no description
7

Module

9       Module   MoreLabels.Set
10

Documentation

12       Module Set
13        : sig end
14
15
16
17
18
19
20
21
22
23       Sets over ordered types.
24
25       This  module  implements the set data structure, given a total ordering
26       function over the set elements. All operations over sets are purely ap‐
27       plicative  (no  side-effects).  The implementation uses balanced binary
28       trees, and is therefore reasonably efficient: insertion and  membership
29       take time logarithmic in the size of the set, for instance.
30
31       The  MoreLabels.Set.Make  functor  constructs  implementations  for any
32       type, given a compare function.  For instance:
33              module IntPairs =
34                struct
35                  type t = int * int
36                  let compare (x0,y0) (x1,y1) =
37                    match Stdlib.compare x0 x1 with
38                        0 -> Stdlib.compare y0 y1
39                      | c -> c
40                end
41
42              module PairsSet = Set.Make(IntPairs)
43
44              let m = PairsSet.(empty |> add (2,3) |> add (5,7) |> add (11,13))
45
46
47       This creates a new module PairsSet , with a new type PairsSet.t of sets
48       of int * int .
49
50       module type OrderedType = sig end
51
52
53       Input signature of the functor MoreLabels.Set.Make .
54
55
56       module type S = sig end
57
58
59       Output signature of the functor MoreLabels.Set.Make .
60
61
62       module Make : functor (Ord : OrderedType) -> sig end
63
64
65       Functor building an implementation of the set structure given a totally
66       ordered type.
67
68
69
70
71
72OCamldoc                          2022-07-22                 MoreLabels.Set(3)
Impressum