1Map(3)                           OCaml library                          Map(3)
2
3
4

NAME

6       Map - Association tables over ordered types.
7

Module

9       Module   Map
10

Documentation

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:
26            module IntPairs =
27              struct
28                type t = int * int
29                let compare (x0,y0) (x1,y1) =
30                  match Stdlib.compare x0 x1 with
31                      0 -> Stdlib.compare y0 y1
32                    | c -> c
33              end
34
35            module PairsMap = Map.Make(IntPairs)
36
37            let m = PairsMap.(empty |> add (0,1) "hello" |> add (1,0) "world")
38
39
40       This creates a new module PairsMap , with a new type 'a  PairsMap.t  of
41       maps  from  int * int to 'a . In this example, m contains string values
42       so its type is string PairsMap.t .
43
44
45
46
47
48       module type OrderedType = sig end
49
50
51       Input signature of the functor Map.Make .
52
53
54       module type S = sig end
55
56
57       Output signature of the functor Map.Make .
58
59
60       module Make : functor (Ord : OrderedType) -> sig end
61
62
63       Functor building an implementation of the map structure given a totally
64       ordered type.
65
66
67
68
69
70OCamldoc                          2020-09-01                            Map(3)
Impressum