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