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