1MoreLabels.Map(3) OCaml library MoreLabels.Map(3)
2
3
4
6 MoreLabels.Map - no description
7
9 Module MoreLabels.Map
10
12 Module Map
13 : sig end
14
15
16
17
18
19
20
21
22
23 Association tables over ordered types.
24
25 This module implements applicative association tables, also known as
26 finite maps or dictionaries, given a total ordering function over the
27 keys. All operations over maps are purely applicative (no side-ef‐
28 fects). The implementation uses balanced binary trees, and therefore
29 searching and insertion take time logarithmic in the size of the map.
30
31 For instance:
32 module IntPairs =
33 struct
34 type t = int * int
35 let compare (x0,y0) (x1,y1) =
36 match Stdlib.compare x0 x1 with
37 0 -> Stdlib.compare y0 y1
38 | c -> c
39 end
40
41 module PairsMap = Map.Make(IntPairs)
42
43 let m = PairsMap.(empty |> add (0,1) "hello" |> add (1,0) "world")
44
45
46 This creates a new module PairsMap , with a new type 'a PairsMap.t of
47 maps from int * int to 'a . In this example, m contains string values
48 so its type is string PairsMap.t .
49
50 module type OrderedType = sig end
51
52
53 Input signature of the functor MoreLabels.Map.Make .
54
55
56 module type S = sig end
57
58
59 Output signature of the functor MoreLabels.Map.Make .
60
61
62 module Make : functor (Ord : OrderedType) -> sig end
63
64
65 Functor building an implementation of the map structure given a totally
66 ordered type.
67
68
69
70
71
72OCamldoc 2023-07-20 MoreLabels.Map(3)