1Map.S(3) OCaml library Map.S(3)
2
3
4
6 Map.S - Output signature of the functor Map.Make.
7
9 Module type Map.S
10
12 Module type S
13 = sig end
14
15
16 Output signature of the functor Map.Make .
17
18
19
20
21
22
23 type key
24
25
26 The type of the map keys.
27
28
29
30 type +'a t
31
32
33 The type of maps from type key to type 'a .
34
35
36
37
38 val empty : 'a t
39
40 The empty map.
41
42
43
44
45 val is_empty : 'a t -> bool
46
47 Test whether a map is empty or not.
48
49
50
51
52 val add : key -> 'a -> 'a t -> 'a t
53
54
55 add x y m returns a map containing the same bindings as m , plus a
56 binding of x to y . If x was already bound in m , its previous binding
57 disappears.
58
59
60
61
62 val find : key -> 'a t -> 'a
63
64
65 find x m returns the current binding of x in m , or raises Not_found if
66 no such binding exists.
67
68
69
70
71 val remove : key -> 'a t -> 'a t
72
73
74 remove x m returns a map containing the same bindings as m , except for
75 x which is unbound in the returned map.
76
77
78
79
80 val mem : key -> 'a t -> bool
81
82
83 mem x m returns true if m contains a binding for x , and false other‐
84 wise.
85
86
87
88
89 val iter : (key -> 'a -> unit) -> 'a t -> unit
90
91
92 iter f m applies f to all bindings in map m . f receives the key as
93 first argument, and the associated value as second argument. The bind‐
94 ings are passed to f in increasing order with respect to the ordering
95 over the type of the keys.
96
97
98
99
100 val map : ('a -> 'b) -> 'a t -> 'b t
101
102
103 map f m returns a map with same domain as m , where the associated
104 value a of all bindings of m has been replaced by the result of the
105 application of f to a . The bindings are passed to f in increasing
106 order with respect to the ordering over the type of the keys.
107
108
109
110
111 val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
112
113 Same as Map.S.map , but the function receives as arguments both the key
114 and the associated value for each binding of the map.
115
116
117
118
119 val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
120
121
122 fold f m a computes (f kN dN ... (f k1 d1 a)...) , where k1 ... kN are
123 the keys of all bindings in m (in increasing order), and d1 ... dN are
124 the associated data.
125
126
127
128
129 val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
130
131 Total ordering between maps. The first argument is a total ordering
132 used to compare data associated with equal keys in the two maps.
133
134
135
136
137 val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
138
139
140 equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is,
141 contain equal keys and associate them with equal data. cmp is the
142 equality predicate used to compare the data associated with the keys.
143
144
145
146
147
148
149OCamldoc 2010-01-29 Map.S(3)