File: Map.Make.html

package info (click to toggle)
ocaml-doc 4.11-2
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 20,580 kB
  • sloc: sh: 37; makefile: 11
file content (553 lines) | stat: -rw-r--r-- 35,063 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="Start" href="index.html">
<link rel="Up" href="Map.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of extensions" rel=Appendix href="index_extensions.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Bool" rel="Chapter" href="Bool.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Bytes" rel="Chapter" href="Bytes.html">
<link title="BytesLabels" rel="Chapter" href="BytesLabels.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalFormat" rel="Chapter" href="CamlinternalFormat.html">
<link title="CamlinternalFormatBasics" rel="Chapter" href="CamlinternalFormatBasics.html">
<link title="CamlinternalLazy" rel="Chapter" href="CamlinternalLazy.html">
<link title="CamlinternalMod" rel="Chapter" href="CamlinternalMod.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Condition" rel="Chapter" href="Condition.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Ephemeron" rel="Chapter" href="Ephemeron.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Float" rel="Chapter" href="Float.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Fun" rel="Chapter" href="Fun.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int" rel="Chapter" href="Int.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Mutex" rel="Chapter" href="Mutex.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Ocaml_operators" rel="Chapter" href="Ocaml_operators.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Option" rel="Chapter" href="Option.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Result" rel="Chapter" href="Result.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Seq" rel="Chapter" href="Seq.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Spacetime" rel="Chapter" href="Spacetime.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Stdlib" rel="Chapter" href="Stdlib.html">
<link title="Str" rel="Chapter" href="Str.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Thread" rel="Chapter" href="Thread.html">
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
<link title="Uchar" rel="Chapter" href="Uchar.html">
<link title="Unit" rel="Chapter" href="Unit.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Weak" rel="Chapter" href="Weak.html"><link title="Iterators" rel="Section" href="#1_Iterators">
<title>Map.Make</title>
</head>
<body>
<div class="navbar">&nbsp;<a class="up" href="Map.html" title="Map">Up</a>
&nbsp;</div>
<h1>Functor <a href="type_Map.Make.html">Map.Make</a></h1>

<pre><span id="MODULEMake"><span class="keyword">module</span> Make</span>: <div class="sig_block"><code class="code"><span class="keyword">functor</span>&nbsp;(</code><code class="code"><span class="constructor">Ord</span></code><code class="code">&nbsp;:&nbsp;</code><code class="type"><a href="Map.OrderedType.html">OrderedType</a></code><code class="code">)&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;</code><code class="type"><a href="Map.S.html">S</a></code><code class="type">  with type key = Ord.t</code></div></pre><div class="info module top">
<div class="info-desc">
<p>Functor building an implementation of the map structure
   given a totally ordered type.</p>
</div>
</div>
<table border="0" cellpadding="3" width="100%">
<tr>
<td align="left" valign="top" width="1%%"><b>Parameters: </b></td>
<td>
<table class="paramstable">
<tr>
<td align="center" valign="top" width="15%">
<code>Ord</code></td>
<td align="center" valign="top">:</td>
<td><code class="type"><a href="Map.OrderedType.html">OrderedType</a></code>
</table>
</td>
</tr>
</table>
<hr width="100%">

<pre><span id="TYPEkey"><span class="keyword">type</span> <code class="type"></code>key</span> </pre>
<div class="info ">
<div class="info-desc">
<p>The type of the map keys.</p>
</div>
</div>


<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">+'a</code> t</span> </pre>
<div class="info ">
<div class="info-desc">
<p>The type of maps from type <code class="code">key</code> to type <code class="code"><span class="keywordsign">'</span>a</code>.</p>
</div>
</div>


<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">'a <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p>The empty map.</p>
</div>
</div>

<pre><span id="VALis_empty"><span class="keyword">val</span> is_empty</span> : <code class="type">'a <a href="Map.S.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Test whether a map is empty or not.</p>
</div>
</div>

<pre><span id="VALmem"><span class="keyword">val</span> mem</span> : <code class="type"><a href="Map.S.html#TYPEkey">key</a> -> 'a <a href="Map.S.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">mem&nbsp;x&nbsp;m</code> returns <code class="code"><span class="keyword">true</span></code> if <code class="code">m</code> contains a binding for <code class="code">x</code>,
       and <code class="code"><span class="keyword">false</span></code> otherwise.</p>
</div>
</div>

<pre><span id="VALadd"><span class="keyword">val</span> add</span> : <code class="type"><a href="Map.S.html#TYPEkey">key</a> -> 'a -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">add&nbsp;x&nbsp;y&nbsp;m</code> returns a map containing the same bindings as
       <code class="code">m</code>, plus a binding of <code class="code">x</code> to <code class="code">y</code>. If <code class="code">x</code> was already bound
       in <code class="code">m</code> to a value that is physically equal to <code class="code">y</code>,
       <code class="code">m</code> is returned unchanged (the result of the function is
       then physically equal to <code class="code">m</code>). Otherwise, the previous binding
       of <code class="code">x</code> in <code class="code">m</code> disappears.</p>
</div>
<ul class="info-attributes">
<li><b>Before 4.03 </b> Physical equality was not ensured.</li>
</ul>
</div>

<pre><span id="VALupdate"><span class="keyword">val</span> update</span> : <code class="type"><a href="Map.S.html#TYPEkey">key</a> -> ('a option -> 'a option) -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">update&nbsp;x&nbsp;f&nbsp;m</code> returns a map containing the same bindings as
        <code class="code">m</code>, except for the binding of <code class="code">x</code>. Depending on the value of
        <code class="code">y</code> where <code class="code">y</code> is <code class="code">f&nbsp;(find_opt&nbsp;x&nbsp;m)</code>, the binding of <code class="code">x</code> is
        added, removed or updated. If <code class="code">y</code> is <code class="code"><span class="constructor">None</span></code>, the binding is
        removed if it exists; otherwise, if <code class="code">y</code> is <code class="code"><span class="constructor">Some</span>&nbsp;z</code> then <code class="code">x</code>
        is associated to <code class="code">z</code> in the resulting map.  If <code class="code">x</code> was already
        bound in <code class="code">m</code> to a value that is physically equal to <code class="code">z</code>, <code class="code">m</code>
        is returned unchanged (the result of the function is then
        physically equal to <code class="code">m</code>).</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.06.0</li>
</ul>
</div>

<pre><span id="VALsingleton"><span class="keyword">val</span> singleton</span> : <code class="type"><a href="Map.S.html#TYPEkey">key</a> -> 'a -> 'a <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">singleton&nbsp;x&nbsp;y</code> returns the one-element map that contains a binding <code class="code">y</code>
        for <code class="code">x</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALremove"><span class="keyword">val</span> remove</span> : <code class="type"><a href="Map.S.html#TYPEkey">key</a> -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">remove&nbsp;x&nbsp;m</code> returns a map containing the same bindings as
       <code class="code">m</code>, except for <code class="code">x</code> which is unbound in the returned map.
       If <code class="code">x</code> was not in <code class="code">m</code>, <code class="code">m</code> is returned unchanged
       (the result of the function is then physically equal to <code class="code">m</code>).</p>
</div>
<ul class="info-attributes">
<li><b>Before 4.03 </b> Physical equality was not ensured.</li>
</ul>
</div>

<pre><span id="VALmerge"><span class="keyword">val</span> merge</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> 'a option -> 'b option -> 'c option) -><br>       'a <a href="Map.S.html#TYPEt">t</a> -> 'b <a href="Map.S.html#TYPEt">t</a> -> 'c <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">merge&nbsp;f&nbsp;m1&nbsp;m2</code> computes a map whose keys are a subset of the keys of
        <code class="code">m1</code> and of <code class="code">m2</code>. The presence of each such binding, and the
        corresponding value, is determined with the function <code class="code">f</code>.
        In terms of the <code class="code">find_opt</code> operation, we have
        <code class="code">find_opt&nbsp;x&nbsp;(merge&nbsp;f&nbsp;m1&nbsp;m2)&nbsp;=&nbsp;f&nbsp;x&nbsp;(find_opt&nbsp;x&nbsp;m1)&nbsp;(find_opt&nbsp;x&nbsp;m2)</code>
        for any key <code class="code">x</code>, provided that <code class="code">f&nbsp;x&nbsp;<span class="constructor">None</span>&nbsp;<span class="constructor">None</span>&nbsp;=&nbsp;<span class="constructor">None</span></code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALunion"><span class="keyword">val</span> union</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> 'a -> 'a -> 'a option) -><br>       'a <a href="Map.S.html#TYPEt">t</a> -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">union&nbsp;f&nbsp;m1&nbsp;m2</code> computes a map whose keys are a subset of the keys
        of <code class="code">m1</code> and of <code class="code">m2</code>.  When the same binding is defined in both
        arguments, the function <code class="code">f</code> is used to combine them.
        This is a special case of <code class="code">merge</code>: <code class="code">union&nbsp;f&nbsp;m1&nbsp;m2</code> is equivalent
        to <code class="code">merge&nbsp;f'&nbsp;m1&nbsp;m2</code>, where</p>
<ul>
<li><code class="code">f'&nbsp;_key&nbsp;<span class="constructor">None</span>&nbsp;<span class="constructor">None</span>&nbsp;=&nbsp;<span class="constructor">None</span></code></li>
<li><code class="code">f'&nbsp;_key&nbsp;(<span class="constructor">Some</span>&nbsp;v)&nbsp;<span class="constructor">None</span>&nbsp;=&nbsp;<span class="constructor">Some</span>&nbsp;v</code></li>
<li><code class="code">f'&nbsp;_key&nbsp;<span class="constructor">None</span>&nbsp;(<span class="constructor">Some</span>&nbsp;v)&nbsp;=&nbsp;<span class="constructor">Some</span>&nbsp;v</code></li>
<li><code class="code">f'&nbsp;key&nbsp;(<span class="constructor">Some</span>&nbsp;v1)&nbsp;(<span class="constructor">Some</span>&nbsp;v2)&nbsp;=&nbsp;f&nbsp;key&nbsp;v1&nbsp;v2</code></li>
</ul>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>

<pre><span id="VALcompare"><span class="keyword">val</span> compare</span> : <code class="type">('a -> 'a -> int) -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a <a href="Map.S.html#TYPEt">t</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Total ordering between maps.  The first argument is a total ordering
        used to compare data associated with equal keys in the two maps.</p>
</div>
</div>

<pre><span id="VALequal"><span class="keyword">val</span> equal</span> : <code class="type">('a -> 'a -> bool) -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a <a href="Map.S.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">equal&nbsp;cmp&nbsp;m1&nbsp;m2</code> tests whether the maps <code class="code">m1</code> and <code class="code">m2</code> are
       equal, that is, contain equal keys and associate them with
       equal data.  <code class="code">cmp</code> is the equality predicate used to compare
       the data associated with the keys.</p>
</div>
</div>

<pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> 'a -> unit) -> 'a <a href="Map.S.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">iter&nbsp;f&nbsp;m</code> applies <code class="code">f</code> to all bindings in map <code class="code">m</code>.
       <code class="code">f</code> receives the key as first argument, and the associated value
       as second argument.  The bindings are passed to <code class="code">f</code> in increasing
       order with respect to the ordering over the type of the keys.</p>
</div>
</div>

<pre><span id="VALfold"><span class="keyword">val</span> fold</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> 'a -> 'b -> 'b) -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'b -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">fold&nbsp;f&nbsp;m&nbsp;a</code> computes <code class="code">(f&nbsp;kN&nbsp;dN&nbsp;...&nbsp;(f&nbsp;k1&nbsp;d1&nbsp;a)...)</code>,
       where <code class="code">k1&nbsp;...&nbsp;kN</code> are the keys of all bindings in <code class="code">m</code>
       (in increasing order), and <code class="code">d1&nbsp;...&nbsp;dN</code> are the associated data.</p>
</div>
</div>

<pre><span id="VALfor_all"><span class="keyword">val</span> for_all</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> 'a -> bool) -> 'a <a href="Map.S.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">for_all&nbsp;p&nbsp;m</code> checks if all the bindings of the map
        satisfy the predicate <code class="code">p</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALexists"><span class="keyword">val</span> exists</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> 'a -> bool) -> 'a <a href="Map.S.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">exists&nbsp;p&nbsp;m</code> checks if at least one binding of the map
        satisfies the predicate <code class="code">p</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALfilter"><span class="keyword">val</span> filter</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> 'a -> bool) -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">filter&nbsp;p&nbsp;m</code> returns the map with all the bindings in <code class="code">m</code>
        that satisfy predicate <code class="code">p</code>. If every binding in <code class="code">m</code> satisfies <code class="code">p</code>,
        <code class="code">m</code> is returned unchanged (the result of the function is then
        physically equal to <code class="code">m</code>)</p>
</div>
<ul class="info-attributes">
<li><b>Before 4.03 </b> Physical equality was not ensured.</li>
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALfilter_map"><span class="keyword">val</span> filter_map</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> 'a -> 'b option) -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'b <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">filter_map&nbsp;f&nbsp;m</code> applies the function <code class="code">f</code> to every binding of
        <code class="code">m</code>, and builds a map from the results. For each binding
        <code class="code">(k,&nbsp;v)</code> in the input map:</p>
<ul>
<li>if <code class="code">f&nbsp;k&nbsp;v</code> is <code class="code"><span class="constructor">None</span></code> then <code class="code">k</code> is not in the result,</li>
<li>if <code class="code">f&nbsp;k&nbsp;v</code> is <code class="code"><span class="constructor">Some</span>&nbsp;v'</code> then the binding <code class="code">(k,&nbsp;v')</code>
          is in the output map.</li>
</ul>
<p>For example, the following function on maps whose values are lists</p>
<pre class="codepre"><code class="code">        filter_map
          (<span class="keyword">fun</span> _k li <span class="keywordsign">-&gt;</span> <span class="keyword">match</span> li <span class="keyword">with</span> [] <span class="keywordsign">-&gt;</span> <span class="constructor">None</span> <span class="keywordsign">|</span> _::tl <span class="keywordsign">-&gt;</span> <span class="constructor">Some</span> tl)
          m
        </code></pre><p>drops all bindings of <code class="code">m</code> whose value is an empty list, and pops
        the first element of each value that is non-empty.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.11.0</li>
</ul>
</div>

<pre><span id="VALpartition"><span class="keyword">val</span> partition</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> 'a -> bool) -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a <a href="Map.S.html#TYPEt">t</a> * 'a <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">partition&nbsp;p&nbsp;m</code> returns a pair of maps <code class="code">(m1,&nbsp;m2)</code>, where
        <code class="code">m1</code> contains all the bindings of <code class="code">m</code> that satisfy the
        predicate <code class="code">p</code>, and <code class="code">m2</code> is the map with all the bindings of
        <code class="code">m</code> that do not satisfy <code class="code">p</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALcardinal"><span class="keyword">val</span> cardinal</span> : <code class="type">'a <a href="Map.S.html#TYPEt">t</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the number of bindings of a map.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALbindings"><span class="keyword">val</span> bindings</span> : <code class="type">'a <a href="Map.S.html#TYPEt">t</a> -> (<a href="Map.S.html#TYPEkey">key</a> * 'a) list</code></pre><div class="info ">
<div class="info-desc">
<p>Return the list of all bindings of the given map.
       The returned list is sorted in increasing order of keys with respect
       to the ordering <code class="code"><span class="constructor">Ord</span>.compare</code>, where <code class="code"><span class="constructor">Ord</span></code> is the argument
       given to <a href="Map.Make.html"><code class="code"><span class="constructor">Map</span>.<span class="constructor">Make</span></code></a>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALmin_binding"><span class="keyword">val</span> min_binding</span> : <code class="type">'a <a href="Map.S.html#TYPEt">t</a> -> <a href="Map.S.html#TYPEkey">key</a> * 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Return the binding with the smallest key in a given map
       (with respect to the <code class="code"><span class="constructor">Ord</span>.compare</code> ordering), or raise
       <code class="code"><span class="constructor">Not_found</span></code> if the map is empty.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALmin_binding_opt"><span class="keyword">val</span> min_binding_opt</span> : <code class="type">'a <a href="Map.S.html#TYPEt">t</a> -> (<a href="Map.S.html#TYPEkey">key</a> * 'a) option</code></pre><div class="info ">
<div class="info-desc">
<p>Return the binding with the smallest key in the given map
       (with respect to the <code class="code"><span class="constructor">Ord</span>.compare</code> ordering), or <code class="code"><span class="constructor">None</span></code>
       if the map is empty.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALmax_binding"><span class="keyword">val</span> max_binding</span> : <code class="type">'a <a href="Map.S.html#TYPEt">t</a> -> <a href="Map.S.html#TYPEkey">key</a> * 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Map.S.html#VALmin_binding"><code class="code"><span class="constructor">Map</span>.<span class="constructor">S</span>.min_binding</code></a>, but returns the binding with
        the largest key in the given map.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALmax_binding_opt"><span class="keyword">val</span> max_binding_opt</span> : <code class="type">'a <a href="Map.S.html#TYPEt">t</a> -> (<a href="Map.S.html#TYPEkey">key</a> * 'a) option</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Map.S.html#VALmin_binding_opt"><code class="code"><span class="constructor">Map</span>.<span class="constructor">S</span>.min_binding_opt</code></a>, but returns the binding with
        the largest key in the given map.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALchoose"><span class="keyword">val</span> choose</span> : <code class="type">'a <a href="Map.S.html#TYPEt">t</a> -> <a href="Map.S.html#TYPEkey">key</a> * 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Return one binding of the given map, or raise <code class="code"><span class="constructor">Not_found</span></code> if
       the map is empty. Which binding is chosen is unspecified,
       but equal bindings will be chosen for equal maps.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALchoose_opt"><span class="keyword">val</span> choose_opt</span> : <code class="type">'a <a href="Map.S.html#TYPEt">t</a> -> (<a href="Map.S.html#TYPEkey">key</a> * 'a) option</code></pre><div class="info ">
<div class="info-desc">
<p>Return one binding of the given map, or <code class="code"><span class="constructor">None</span></code> if
       the map is empty. Which binding is chosen is unspecified,
       but equal bindings will be chosen for equal maps.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALsplit"><span class="keyword">val</span> split</span> : <code class="type"><a href="Map.S.html#TYPEkey">key</a> -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a <a href="Map.S.html#TYPEt">t</a> * 'a option * 'a <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">split&nbsp;x&nbsp;m</code> returns a triple <code class="code">(l,&nbsp;data,&nbsp;r)</code>, where
          <code class="code">l</code> is the map with all the bindings of <code class="code">m</code> whose key
        is strictly less than <code class="code">x</code>;
          <code class="code">r</code> is the map with all the bindings of <code class="code">m</code> whose key
        is strictly greater than <code class="code">x</code>;
          <code class="code">data</code> is <code class="code"><span class="constructor">None</span></code> if <code class="code">m</code> contains no binding for <code class="code">x</code>,
          or <code class="code"><span class="constructor">Some</span>&nbsp;v</code> if <code class="code">m</code> binds <code class="code">v</code> to <code class="code">x</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALfind"><span class="keyword">val</span> find</span> : <code class="type"><a href="Map.S.html#TYPEkey">key</a> -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">find&nbsp;x&nbsp;m</code> returns the current value of <code class="code">x</code> in <code class="code">m</code>,
       or raises <code class="code"><span class="constructor">Not_found</span></code> if no binding for <code class="code">x</code> exists.</p>
</div>
</div>

<pre><span id="VALfind_opt"><span class="keyword">val</span> find_opt</span> : <code class="type"><a href="Map.S.html#TYPEkey">key</a> -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a option</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">find_opt&nbsp;x&nbsp;m</code> returns <code class="code"><span class="constructor">Some</span>&nbsp;v</code> if the current value of <code class="code">x</code>
        in <code class="code">m</code> is <code class="code">v</code>, or <code class="code"><span class="constructor">None</span></code> if no binding for <code class="code">x</code> exists.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALfind_first"><span class="keyword">val</span> find_first</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> bool) -> 'a <a href="Map.S.html#TYPEt">t</a> -> <a href="Map.S.html#TYPEkey">key</a> * 'a</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">find_first&nbsp;f&nbsp;m</code>, where <code class="code">f</code> is a monotonically increasing function,
       returns the binding of <code class="code">m</code> with the lowest key <code class="code">k</code> such that <code class="code">f&nbsp;k</code>,
       or raises <code class="code"><span class="constructor">Not_found</span></code> if no such key exists.</p>

<p>For example, <code class="code">find_first&nbsp;(<span class="keyword">fun</span>&nbsp;k&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="constructor">Ord</span>.compare&nbsp;k&nbsp;x&nbsp;&gt;=&nbsp;0)&nbsp;m</code> will return
       the first binding <code class="code">k,&nbsp;v</code> of <code class="code">m</code> where <code class="code"><span class="constructor">Ord</span>.compare&nbsp;k&nbsp;x&nbsp;&gt;=&nbsp;0</code>
       (intuitively: <code class="code">k&nbsp;&gt;=&nbsp;x</code>), or raise <code class="code"><span class="constructor">Not_found</span></code> if <code class="code">x</code> is greater than any
       element of <code class="code">m</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALfind_first_opt"><span class="keyword">val</span> find_first_opt</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> bool) -> 'a <a href="Map.S.html#TYPEt">t</a> -> (<a href="Map.S.html#TYPEkey">key</a> * 'a) option</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">find_first_opt&nbsp;f&nbsp;m</code>, where <code class="code">f</code> is a monotonically increasing function,
       returns an option containing the binding of <code class="code">m</code> with the lowest key <code class="code">k</code>
       such that <code class="code">f&nbsp;k</code>, or <code class="code"><span class="constructor">None</span></code> if no such key exists.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALfind_last"><span class="keyword">val</span> find_last</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> bool) -> 'a <a href="Map.S.html#TYPEt">t</a> -> <a href="Map.S.html#TYPEkey">key</a> * 'a</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">find_last&nbsp;f&nbsp;m</code>, where <code class="code">f</code> is a monotonically decreasing function,
       returns the binding of <code class="code">m</code> with the highest key <code class="code">k</code> such that <code class="code">f&nbsp;k</code>,
       or raises <code class="code"><span class="constructor">Not_found</span></code> if no such key exists.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALfind_last_opt"><span class="keyword">val</span> find_last_opt</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> bool) -> 'a <a href="Map.S.html#TYPEt">t</a> -> (<a href="Map.S.html#TYPEkey">key</a> * 'a) option</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">find_last_opt&nbsp;f&nbsp;m</code>, where <code class="code">f</code> is a monotonically decreasing function,
       returns an option containing the binding of <code class="code">m</code> with the highest key <code class="code">k</code>
       such that <code class="code">f&nbsp;k</code>, or <code class="code"><span class="constructor">None</span></code> if no such key exists.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALmap"><span class="keyword">val</span> map</span> : <code class="type">('a -> 'b) -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'b <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">map&nbsp;f&nbsp;m</code> returns a map with same domain as <code class="code">m</code>, where the
       associated value <code class="code">a</code> of all bindings of <code class="code">m</code> has been
       replaced by the result of the application of <code class="code">f</code> to <code class="code">a</code>.
       The bindings are passed to <code class="code">f</code> in increasing order
       with respect to the ordering over the type of the keys.</p>
</div>
</div>

<pre><span id="VALmapi"><span class="keyword">val</span> mapi</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> -> 'a -> 'b) -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'b <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Map.S.html#VALmap"><code class="code"><span class="constructor">Map</span>.<span class="constructor">S</span>.map</code></a>, but the function receives as arguments both the
       key and the associated value for each binding of the map.</p>
</div>
</div>
<h2 id="1_Iterators">Iterators</h2>
<pre><span id="VALto_seq"><span class="keyword">val</span> to_seq</span> : <code class="type">'a <a href="Map.S.html#TYPEt">t</a> -> (<a href="Map.S.html#TYPEkey">key</a> * 'a) <a href="Seq.html#TYPEt">Seq.t</a></code></pre><div class="info ">
<div class="info-desc">
<p>Iterate on the whole map, in ascending order of keys</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.07</li>
</ul>
</div>

<pre><span id="VALto_seq_from"><span class="keyword">val</span> to_seq_from</span> : <code class="type"><a href="Map.S.html#TYPEkey">key</a> -> 'a <a href="Map.S.html#TYPEt">t</a> -> (<a href="Map.S.html#TYPEkey">key</a> * 'a) <a href="Seq.html#TYPEt">Seq.t</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">to_seq_from&nbsp;k&nbsp;m</code> iterates on a subset of the bindings of <code class="code">m</code>,
        in ascending order of keys, from key <code class="code">k</code> or above.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.07</li>
</ul>
</div>

<pre><span id="VALadd_seq"><span class="keyword">val</span> add_seq</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> * 'a) <a href="Seq.html#TYPEt">Seq.t</a> -> 'a <a href="Map.S.html#TYPEt">t</a> -> 'a <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p>Add the given bindings to the map, in order.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.07</li>
</ul>
</div>

<pre><span id="VALof_seq"><span class="keyword">val</span> of_seq</span> : <code class="type">(<a href="Map.S.html#TYPEkey">key</a> * 'a) <a href="Seq.html#TYPEt">Seq.t</a> -> 'a <a href="Map.S.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p>Build a map from the given bindings</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.07</li>
</ul>
</div>
</body></html>