23
23
* along with this program; if not, write to the Free Software
24
24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
25
25
26
+ (* ```res prelude
27
+ type key = int
28
+ type t<'a>
29
+ ```
30
+ *)
31
+
26
32
# 28 " others/mapm.cppo.mli"
27
33
type key = int
28
34
# 32 "others/mapm.cppo.mli"
@@ -37,41 +43,34 @@ val has: 'a t -> key -> bool
37
43
38
44
val cmpU : 'a t -> 'a t -> ('a -> 'a -> int [@ bs]) -> int
39
45
val cmp : 'a t -> 'a t -> ('a -> 'a -> int ) -> int
40
- (* * `cmp m1 m2 cmp`
41
- First compare by size, if size is the same,
42
- compare by key, value pair
43
- *)
46
+ (* * `cmp(m1, m2, cmp)` First compare by size, if size is the same, compare by
47
+ key, value pair. *)
44
48
45
49
val eqU : 'a t -> 'a t -> ('a -> 'a -> bool [@ bs]) -> bool
46
50
val eq : 'a t -> 'a t -> ('a -> 'a -> bool ) -> bool
47
- (* * `eq m1 m2 cmp` *)
51
+ (* * `eq(m1, m2, cmp) ` *)
48
52
49
53
val forEachU : 'a t -> (key -> 'a -> unit [@ bs]) -> unit
50
54
val forEach : 'a t -> (key -> 'a -> unit ) -> unit
51
- (* * `forEach m f` applies `f` to all bindings in map `m`.
52
- `f` receives the key as first argument, and the associated value
53
- as second argument.
54
- The application order of `f` is in increasing order. *)
55
+ (* * `forEach(m, f)` applies `f` to all bindings in map `m`. `f` receives the
56
+ key as first argument, and the associated value as second argument. The
57
+ application order of `f` is in increasing order. *)
55
58
56
59
val reduceU : 'a t -> 'b -> ('b -> key -> 'a -> 'b [@ bs]) -> 'b
57
60
val reduce : 'a t -> 'b -> ('b -> key -> 'a -> 'b ) -> 'b
58
- (* * `reduce m a f` computes `(f kN dN ... (f k1 d1 a)...)`,
59
- where `k1 ... kN` are the keys of all bindings in `m `
60
- (in increasing order), and `d1 ... dN` are the associated data. *)
61
+ (* * `reduce(m, a, f), computes`(f(kN, dN) ... (f(k1, d1, a)) ...)`, where`k1 ...
62
+ kN`are the keys of all bindings in`m`(in increasing order), and`d1 ... dN `
63
+ are the associated data. *)
61
64
62
65
val everyU : 'a t -> (key -> 'a -> bool [@ bs]) -> bool
63
66
val every : 'a t -> (key -> 'a -> bool ) -> bool
64
- (* * `every m p` checks if all the bindings of the map
65
- satisfy the predicate `p`.
66
- The application order of `p` is unspecified.
67
- *)
67
+ (* * `every(m, p)` checks if all the bindings of the map satisfy the predicate
68
+ `p`. The application order of `p` is unspecified. *)
68
69
69
70
val someU : 'a t -> (key -> 'a -> bool [@ bs]) -> bool
70
71
val some : 'a t -> (key -> 'a -> bool ) -> bool
71
- (* * `some m p` checks if at least one binding of the map
72
- satisfy the predicate `p`.
73
- The application order of `p` is unspecified.
74
- *)
72
+ (* * `some(m, p)` checks if at least one binding of the map satisfy the
73
+ predicate `p`. The application order of `p` is unspecified. *)
75
74
76
75
77
76
@@ -81,7 +80,6 @@ val toList: 'a t -> (key * 'a) list
81
80
(* * In increasing order *)
82
81
83
82
val toArray : 'a t -> (key * 'a ) array
84
- (* * In increasing order *)
85
83
86
84
val fromArray : (key * 'a ) array -> 'a t
87
85
val keysToArray : 'a t -> key array
@@ -99,9 +97,7 @@ val getUndefined: 'a t -> key -> 'a Js.undefined
99
97
val getWithDefault : 'a t -> key -> 'a -> 'a
100
98
val getExn : 'a t -> key -> 'a
101
99
val checkInvariantInternal : _ t -> unit
102
- (* *
103
- **raise** when invariant is not held
104
- *)
100
+ (* * Raise when invariant is not held. *)
105
101
106
102
107
103
@@ -110,26 +106,24 @@ val checkInvariantInternal: _ t -> unit
110
106
(* TODO: add functional `merge, partition, keep, split`*)
111
107
112
108
val remove : 'a t -> key -> unit
113
- (* * `remove m x ` do the in-place modification *)
109
+ (* * `remove(m, x) ` do the in-place modification. *)
114
110
115
111
val removeMany : 'a t -> key array -> unit
116
112
117
113
val set : 'a t -> key -> 'a -> unit
118
- (* * `set m x y` do the in-place modification, return
119
- `m` for chaining. If `x` was already bound
120
- in `m`, its previous binding disappears. *)
114
+ (* * `set(m, x, y)` do the in-place modification, return `m` for chaining. If
115
+ `x` was already bound in `m`, its previous binding disappears. *)
121
116
122
117
val updateU : 'a t -> key -> ('a option -> 'a option [@ bs]) -> unit
123
118
val update : 'a t -> key -> ('a option -> 'a option ) -> unit
124
119
125
120
126
121
val mapU : 'a t -> ('a -> 'b [@ bs]) -> 'b t
127
122
val map : 'a t -> ('a -> 'b ) -> 'b t
128
- (* * `map m f` returns a map with same domain as `m`, where the
129
- associated value `a` of all bindings of `m` has been
130
- replaced by the result of the application of `f` to `a`.
131
- The bindings are passed to `f` in increasing order
132
- with respect to the ordering over the type of the keys. *)
123
+ (* * `map(m, f)` returns a map with same domain as `m`, where the associated
124
+ value a of all bindings of `m` has been replaced by the result of the
125
+ application of `f` to `a`. The bindings are passed to `f` in increasing
126
+ order with respect to the ordering over the type of the keys. *)
133
127
134
128
val mapWithKeyU : 'a t -> (key -> 'a -> 'b [@ bs]) -> 'b t
135
129
val mapWithKey : 'a t -> (key -> 'a -> 'b ) -> 'b t
0 commit comments