-
Notifications
You must be signed in to change notification settings - Fork 465
/
Copy pathhashtblLabels.js
199 lines (172 loc) · 3.95 KB
/
hashtblLabels.js
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
import * as Hashtbl from "./hashtbl.js";
function add(tbl, key, data) {
Hashtbl.add(tbl, key, data);
}
function replace(tbl, key, data) {
Hashtbl.replace(tbl, key, data);
}
function iter(f, tbl) {
Hashtbl.iter((function (key, data) {
f(key, data);
}), tbl);
}
function filter_map_inplace(f, tbl) {
Hashtbl.filter_map_inplace((function (key, data) {
return f(key, data);
}), tbl);
}
function fold(f, tbl, init) {
return Hashtbl.fold((function (key, data, acc) {
return f(key, data, acc);
}), tbl, init);
}
function MakeSeeded(H) {
let include = Hashtbl.MakeSeeded(H);
let add = include.add;
let replace = include.replace;
let iter = include.iter;
let filter_map_inplace = include.filter_map_inplace;
let fold = include.fold;
let add$1 = function (tbl, key, data) {
add(tbl, key, data);
};
let replace$1 = function (tbl, key, data) {
replace(tbl, key, data);
};
let iter$1 = function (f, tbl) {
iter((function (key, data) {
f(key, data);
}), tbl);
};
let filter_map_inplace$1 = function (f, tbl) {
filter_map_inplace((function (key, data) {
return f(key, data);
}), tbl);
};
let fold$1 = function (f, tbl, init) {
return fold((function (key, data, acc) {
return f(key, data, acc);
}), tbl, init);
};
return {
create: include.create,
clear: include.clear,
reset: include.reset,
copy: include.copy,
add: add$1,
remove: include.remove,
find: include.find,
find_opt: include.find_opt,
find_all: include.find_all,
replace: replace$1,
mem: include.mem,
iter: iter$1,
filter_map_inplace: filter_map_inplace$1,
fold: fold$1,
length: include.length,
stats: include.stats
};
}
function Make(H) {
let hash = function (_seed, x) {
return H.hash(x);
};
let H_equal = H.equal;
let H$1 = {
equal: H_equal,
hash: hash
};
let include = Hashtbl.MakeSeeded(H$1);
let create = include.create;
let add = include.add;
let replace = include.replace;
let iter = include.iter;
let filter_map_inplace = include.filter_map_inplace;
let fold = include.fold;
let add$1 = function (tbl, key, data) {
add(tbl, key, data);
};
let replace$1 = function (tbl, key, data) {
replace(tbl, key, data);
};
let iter$1 = function (f, tbl) {
iter((function (key, data) {
f(key, data);
}), tbl);
};
let filter_map_inplace$1 = function (f, tbl) {
filter_map_inplace((function (key, data) {
return f(key, data);
}), tbl);
};
let fold$1 = function (f, tbl, init) {
return fold((function (key, data, acc) {
return f(key, data, acc);
}), tbl, init);
};
let create$1 = function (sz) {
return create(false, sz);
};
return {
create: create$1,
clear: include.clear,
reset: include.reset,
copy: include.copy,
add: add$1,
remove: include.remove,
find: include.find,
find_opt: include.find_opt,
find_all: include.find_all,
replace: replace$1,
mem: include.mem,
iter: iter$1,
filter_map_inplace: filter_map_inplace$1,
fold: fold$1,
length: include.length,
stats: include.stats
};
}
let create = Hashtbl.create;
let clear = Hashtbl.clear;
let reset = Hashtbl.reset;
let copy = Hashtbl.copy;
let find = Hashtbl.find;
let find_opt = Hashtbl.find_opt;
let find_all = Hashtbl.find_all;
let mem = Hashtbl.mem;
let remove = Hashtbl.remove;
let length = Hashtbl.length;
let randomize = Hashtbl.randomize;
let is_randomized = Hashtbl.is_randomized;
let stats = Hashtbl.stats;
let hash = Hashtbl.hash;
let seeded_hash = Hashtbl.seeded_hash;
let hash_param = Hashtbl.hash_param;
let seeded_hash_param = Hashtbl.seeded_hash_param;
export {
create,
clear,
reset,
copy,
find,
find_opt,
find_all,
mem,
remove,
length,
randomize,
is_randomized,
stats,
hash,
seeded_hash,
hash_param,
seeded_hash_param,
add,
replace,
iter,
filter_map_inplace,
fold,
MakeSeeded,
Make,
}
/* No side effect */