3030
3131 For example:
3232 {[
33- type t = int
33+ type t = int
3434 module I0 =
3535 (val Belt.Id.hashableU
3636 ~hash:(fun[\@bs] (a : t) -> a & 0xff_ff)
@@ -75,13 +75,13 @@ module Int = Belt_HashMapInt
7575
7676
7777(* * Specalized when key type is [string], more efficient
78- than the gerneic type *)
78+ than the gerneic type *)
7979module String = Belt_HashMapString
8080
8181
8282
8383
84- type ('key,'value,'id) t
84+ type ('key,'value,'id) t
8585(* * The type of hash tables from type ['key] to type ['value]. *)
8686
8787type ('a, 'id) id = ('a , 'id ) Belt_Id .hashable
@@ -93,32 +93,30 @@ val make: hintSize:int -> id:('key, 'id) id -> ('key,'value,'id) t
9393val clear : ('key , 'value , 'id ) t -> unit
9494(* * Empty a hash table. *)
9595
96- val isEmpty : _ t -> bool
96+ val isEmpty : _ t -> bool
9797
9898val set : ('key , 'value , 'id ) t -> 'key -> 'value -> unit
9999(* * [set tbl k v] if [k] does not exist,
100100 add the binding [k,v], otherwise, update the old value with the new
101101 [v]
102102*)
103-
103+
104104val copy : ('key , 'value , 'id ) t -> ('key , 'value , 'id ) t
105-
105+
106106val get : ('key , 'value , 'id ) t -> 'key -> 'value option
107107
108-
108+
109109val has : ('key , 'value , 'id ) t -> 'key -> bool
110110(* * [has tbl x] checks if [x] is bound in [tbl]. *)
111111
112112val remove : ('key , 'value , 'id ) t -> 'key -> unit
113113
114- val forEachU : ('key , 'value , 'id ) t -> ('key -> 'value -> unit [@ bs]) -> unit
115114val forEach : ('key , 'value , 'id ) t -> ('key -> 'value -> unit ) -> unit
116115(* * [forEach tbl f] applies [f] to all bindings in table [tbl].
117116 [f] receives the key as first argument, and the associated value
118117 as second argument. Each binding is presented exactly once to [f].
119118*)
120119
121- val reduceU : ('key , 'value , 'id ) t -> 'c -> ('c -> 'key -> 'value -> 'c [@ bs]) -> 'c
122120val reduce : ('key , 'value , 'id ) t -> 'c -> ('c -> 'key -> 'value -> 'c ) -> 'c
123121(* * [reduce tbl init f] computes
124122 [(f kN dN ... (f k1 d1 init)...)],
@@ -133,11 +131,10 @@ val reduce: ('key, 'value, 'id ) t -> 'c -> ('c -> 'key -> 'value -> 'c) -> 'c
133131*)
134132
135133
136- val keepMapInPlaceU : ('key , 'value , 'id ) t -> ('key -> 'value -> 'value option [@ bs]) -> unit
137134val keepMapInPlace : ('key , 'value , 'id ) t -> ('key -> 'value -> 'value option ) -> unit
138135
139136
140- val size : _ t -> int
137+ val size : _ t -> int
141138(* * [size tbl] returns the number of bindings in [tbl].
142139 It takes constant time. *)
143140
@@ -146,14 +143,23 @@ val size: _ t -> int
146143
147144
148145
149- val toArray : ('key , 'value , 'id ) t -> ('key * 'value ) array
150- val keysToArray : ('key , _ , _ ) t -> 'key array
151- val valuesToArray : (_ ,'value,_) t -> 'value array
152- val fromArray : ('key * 'value ) array -> id :('key ,'id ) id -> ('key , 'value , 'id ) t
146+ val toArray : ('key , 'value , 'id ) t -> ('key * 'value ) array
147+ val keysToArray : ('key , _ , _ ) t -> 'key array
148+ val valuesToArray : (_ ,'value,_) t -> 'value array
149+ val fromArray : ('key * 'value ) array -> id :('key ,'id ) id -> ('key , 'value , 'id ) t
153150val mergeMany : ('key , 'value , 'id ) t -> ('key * 'value ) array -> unit
154151val getBucketHistogram : _ t -> int array
155152val logStats : _ t -> unit
156153
157- val ofArray : ('key * 'value ) array -> id :('key ,'id ) id -> ('key , 'value , 'id ) t
154+ val ofArray : ('key * 'value ) array -> id :('key ,'id ) id -> ('key , 'value , 'id ) t
158155[@@ ocaml.deprecated "Use fromArray instead" ]
159156
157+
158+ (* * {1 Uncurried version} *)
159+
160+
161+ val forEachU : ('key , 'value , 'id ) t -> ('key -> 'value -> unit [@ bs]) -> unit
162+
163+ val reduceU : ('key , 'value , 'id ) t -> 'c -> ('c -> 'key -> 'value -> 'c [@ bs]) -> 'c
164+
165+ val keepMapInPlaceU : ('key , 'value , 'id ) t -> ('key -> 'value -> 'value option [@ bs]) -> unit
0 commit comments