squint-cljs 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.js +1 -1152
- package/lib/cli.js +37 -35
- package/lib/compiler.js +1061 -471
- package/lib/compiler.node.js +1237 -1107
- package/package.json +2 -1
- package/src/squint/core.js +1162 -0
- package/lib/cljs_core.js +0 -793
package/core.js
CHANGED
|
@@ -1,1152 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export function _PLUS_(...xs) {
|
|
3
|
-
return xs.reduce((x, y) => x + y, 0);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export function _(...xs) {
|
|
7
|
-
return xs.reduce((x, y) => x - y);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function satisfies_QMARK_(protocol, x) {
|
|
11
|
-
return x[protocol];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function assoc_BANG_(m, k, v, ...kvs) {
|
|
15
|
-
if (kvs.length % 2 !== 0) {
|
|
16
|
-
throw new Error('Illegal argument: assoc expects an odd number of arguments.');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
switch (typeConst(m)) {
|
|
20
|
-
case MAP_TYPE:
|
|
21
|
-
m.set(k, v);
|
|
22
|
-
|
|
23
|
-
for (let i = 0; i < kvs.length; i += 2) {
|
|
24
|
-
m.set(kvs[i], kvs[i + 1]);
|
|
25
|
-
}
|
|
26
|
-
break;
|
|
27
|
-
case ARRAY_TYPE:
|
|
28
|
-
case OBJECT_TYPE:
|
|
29
|
-
m[k] = v;
|
|
30
|
-
|
|
31
|
-
for (let i = 0; i < kvs.length; i += 2) {
|
|
32
|
-
m[kvs[i]] = kvs[i + 1];
|
|
33
|
-
}
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
throw new Error(
|
|
37
|
-
'Illegal argument: assoc! expects a Map, Array, or Object as the first argument.'
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return m;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function assoc(o, k, v, ...kvs) {
|
|
45
|
-
if (!o) {
|
|
46
|
-
o = {};
|
|
47
|
-
}
|
|
48
|
-
switch (typeConst(o)) {
|
|
49
|
-
case MAP_TYPE:
|
|
50
|
-
return assoc_BANG_(new Map(o.entries()), k, v, ...kvs);
|
|
51
|
-
case ARRAY_TYPE:
|
|
52
|
-
return assoc_BANG_([...o], k, v, ...kvs);
|
|
53
|
-
case OBJECT_TYPE:
|
|
54
|
-
return assoc_BANG_({ ...o }, k, v, ...kvs);
|
|
55
|
-
default:
|
|
56
|
-
throw new Error(
|
|
57
|
-
'Illegal argument: assoc expects a Map, Array, or Object as the first argument.'
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const MAP_TYPE = 1;
|
|
63
|
-
const ARRAY_TYPE = 2;
|
|
64
|
-
const OBJECT_TYPE = 3;
|
|
65
|
-
const LIST_TYPE = 4;
|
|
66
|
-
const SET_TYPE = 5;
|
|
67
|
-
const LAZY_ITERABLE_TYPE = 6;
|
|
68
|
-
|
|
69
|
-
function emptyOfType(type) {
|
|
70
|
-
switch (type) {
|
|
71
|
-
case MAP_TYPE:
|
|
72
|
-
return new Map();
|
|
73
|
-
case ARRAY_TYPE:
|
|
74
|
-
return [];
|
|
75
|
-
case OBJECT_TYPE:
|
|
76
|
-
return {};
|
|
77
|
-
case LIST_TYPE:
|
|
78
|
-
return new List();
|
|
79
|
-
case SET_TYPE:
|
|
80
|
-
return new Set();
|
|
81
|
-
case LAZY_ITERABLE_TYPE:
|
|
82
|
-
return lazy(function* () {
|
|
83
|
-
return;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
return undefined;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function typeConst(obj) {
|
|
90
|
-
if (obj instanceof Map) return MAP_TYPE;
|
|
91
|
-
if (obj instanceof Set) return SET_TYPE;
|
|
92
|
-
if (obj instanceof List) return LIST_TYPE;
|
|
93
|
-
if (obj instanceof Array) return ARRAY_TYPE;
|
|
94
|
-
if (obj instanceof LazyIterable) return LAZY_ITERABLE_TYPE;
|
|
95
|
-
if (obj instanceof Object) return OBJECT_TYPE;
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function assoc_in_with(f, fname, o, keys, value) {
|
|
100
|
-
let baseType = typeConst(o);
|
|
101
|
-
if (baseType !== MAP_TYPE && baseType !== ARRAY_TYPE && baseType !== OBJECT_TYPE)
|
|
102
|
-
throw new Error(
|
|
103
|
-
`Illegal argument: ${fname} expects the first argument to be a Map, Array, or Object.`
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
const chain = [o];
|
|
107
|
-
let lastInChain = o;
|
|
108
|
-
|
|
109
|
-
for (let i = 0; i < keys.length - 1; i += 1) {
|
|
110
|
-
let k = keys[i];
|
|
111
|
-
let chainValue;
|
|
112
|
-
if (lastInChain instanceof Map) chainValue = lastInChain.get(k);
|
|
113
|
-
else chainValue = lastInChain[k];
|
|
114
|
-
if (!chainValue) {
|
|
115
|
-
chainValue = emptyOfType(baseType);
|
|
116
|
-
}
|
|
117
|
-
chain.push(chainValue);
|
|
118
|
-
lastInChain = chainValue;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
chain.push(value);
|
|
122
|
-
|
|
123
|
-
for (let i = chain.length - 2; i >= 0; i -= 1) {
|
|
124
|
-
chain[i] = f(chain[i], keys[i], chain[i + 1]);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return chain[0];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function assoc_in(o, keys, value) {
|
|
131
|
-
return assoc_in_with(assoc, 'assoc-in', o, keys, value);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export function assoc_in_BANG_(o, keys, value) {
|
|
135
|
-
return assoc_in_with(assoc_BANG_, 'assoc-in!', o, keys, value);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function comp(...fs) {
|
|
139
|
-
if (fs.length === 0) {
|
|
140
|
-
return identity;
|
|
141
|
-
} else if (fs.length === 1) {
|
|
142
|
-
return fs[0];
|
|
143
|
-
}
|
|
144
|
-
let [f, ...more] = fs.slice().reverse();
|
|
145
|
-
return function (...args) {
|
|
146
|
-
let x = f(...args);
|
|
147
|
-
for (const g of more) {
|
|
148
|
-
x = g(x);
|
|
149
|
-
}
|
|
150
|
-
return x;
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export function conj_BANG_(...xs) {
|
|
155
|
-
if (xs.length === 0) {
|
|
156
|
-
return vector();
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
let [o, ...rest] = xs;
|
|
160
|
-
|
|
161
|
-
if (o === null || o === undefined) {
|
|
162
|
-
o = [];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
switch (typeConst(o)) {
|
|
166
|
-
case SET_TYPE:
|
|
167
|
-
for (const x of rest) {
|
|
168
|
-
o.add(x);
|
|
169
|
-
}
|
|
170
|
-
break;
|
|
171
|
-
case LIST_TYPE:
|
|
172
|
-
o.unshift(...rest.reverse());
|
|
173
|
-
break;
|
|
174
|
-
case ARRAY_TYPE:
|
|
175
|
-
o.push(...rest);
|
|
176
|
-
break;
|
|
177
|
-
case MAP_TYPE:
|
|
178
|
-
for (const x of rest) {
|
|
179
|
-
if (!(x instanceof Array))
|
|
180
|
-
iterable(x).forEach((kv) => {
|
|
181
|
-
o.set(kv[0], kv[1]);
|
|
182
|
-
});
|
|
183
|
-
else o.set(x[0], x[1]);
|
|
184
|
-
}
|
|
185
|
-
break;
|
|
186
|
-
case OBJECT_TYPE:
|
|
187
|
-
for (const x of rest) {
|
|
188
|
-
if (!(x instanceof Array)) Object.assign(o, x);
|
|
189
|
-
else o[x[0]] = x[1];
|
|
190
|
-
}
|
|
191
|
-
break;
|
|
192
|
-
default:
|
|
193
|
-
throw new Error(
|
|
194
|
-
'Illegal argument: conj! expects a Set, Array, List, Map, or Object as the first argument.'
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return o;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export function conj(...xs) {
|
|
202
|
-
if (xs.length === 0) {
|
|
203
|
-
return vector();
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
let [o, ...rest] = xs;
|
|
207
|
-
|
|
208
|
-
if (o === null || o === undefined) {
|
|
209
|
-
o = [];
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
switch (typeConst(o)) {
|
|
213
|
-
case SET_TYPE:
|
|
214
|
-
return new Set([...o, ...rest]);
|
|
215
|
-
case LIST_TYPE:
|
|
216
|
-
return new List(...rest.reverse(), ...o);
|
|
217
|
-
case ARRAY_TYPE:
|
|
218
|
-
return [...o, ...rest];
|
|
219
|
-
case MAP_TYPE:
|
|
220
|
-
const m = new Map(o);
|
|
221
|
-
|
|
222
|
-
for (const x of rest) {
|
|
223
|
-
if (!(x instanceof Array))
|
|
224
|
-
iterable(x).forEach((kv) => {
|
|
225
|
-
m.set(kv[0], kv[1]);
|
|
226
|
-
});
|
|
227
|
-
else m.set(x[0], x[1]);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return m;
|
|
231
|
-
case LAZY_ITERABLE_TYPE:
|
|
232
|
-
return lazy(function* () {
|
|
233
|
-
yield* rest;
|
|
234
|
-
yield* o;
|
|
235
|
-
});
|
|
236
|
-
case OBJECT_TYPE:
|
|
237
|
-
const o2 = { ...o };
|
|
238
|
-
|
|
239
|
-
for (const x of rest) {
|
|
240
|
-
if (!(x instanceof Array)) Object.assign(o2, x);
|
|
241
|
-
else o2[x[0]] = x[1];
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
return o2;
|
|
245
|
-
default:
|
|
246
|
-
throw new Error(
|
|
247
|
-
'Illegal argument: conj expects a Set, Array, List, Map, or Object as the first argument.'
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export function disj_BANG_(s, ...xs) {
|
|
253
|
-
for (const x of xs) {
|
|
254
|
-
s.delete(x);
|
|
255
|
-
}
|
|
256
|
-
return s;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
export function disj(s, ...xs) {
|
|
260
|
-
let s1 = new Set([...s]);
|
|
261
|
-
return disj_BANG_(s1, ...xs);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
export function contains_QMARK_(coll, v) {
|
|
265
|
-
switch (typeConst(coll)) {
|
|
266
|
-
case SET_TYPE:
|
|
267
|
-
case MAP_TYPE:
|
|
268
|
-
return coll.has(v);
|
|
269
|
-
case undefined:
|
|
270
|
-
return false;
|
|
271
|
-
default:
|
|
272
|
-
return v in coll;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
export function dissoc_BANG_(m, ...ks) {
|
|
278
|
-
for (const k of ks) {
|
|
279
|
-
delete m[k];
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
return m;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
export function dissoc(m, ...ks) {
|
|
286
|
-
let m2 = { ...m };
|
|
287
|
-
|
|
288
|
-
for (const k of ks) {
|
|
289
|
-
delete m2[k];
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
return m2;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export function inc(n) {
|
|
296
|
-
return n + 1;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
export function dec(n) {
|
|
300
|
-
return n - 1;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
export function println(...args) {
|
|
304
|
-
console.log(...args);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export function nth(coll, idx, orElse) {
|
|
308
|
-
if (coll) {
|
|
309
|
-
const elt = coll[idx];
|
|
310
|
-
if (elt !== undefined) {
|
|
311
|
-
return elt;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return orElse;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
export function get(coll, key, otherwise = undefined) {
|
|
318
|
-
let v;
|
|
319
|
-
switch (typeConst(coll)) {
|
|
320
|
-
case SET_TYPE:
|
|
321
|
-
if (coll.has(key)) v = key;
|
|
322
|
-
break;
|
|
323
|
-
case MAP_TYPE:
|
|
324
|
-
v = coll.get(key);
|
|
325
|
-
break;
|
|
326
|
-
case undefined:
|
|
327
|
-
break;
|
|
328
|
-
default:
|
|
329
|
-
v = coll[key];
|
|
330
|
-
break;
|
|
331
|
-
}
|
|
332
|
-
return v !== undefined ? v : otherwise;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
export function seqable_QMARK_(x) {
|
|
336
|
-
// String is iterable but doesn't allow `m in s`
|
|
337
|
-
return typeof x === 'string' || x === null || x === undefined || Symbol.iterator in x;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
export function iterable(x) {
|
|
341
|
-
// nil puns to empty iterable, support passing nil to first/rest/reduce, etc.
|
|
342
|
-
if (x === null || x === undefined) {
|
|
343
|
-
return [];
|
|
344
|
-
}
|
|
345
|
-
if (seqable_QMARK_(x)) {
|
|
346
|
-
return x;
|
|
347
|
-
}
|
|
348
|
-
return Object.entries(x);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
export const IIterable = Symbol('Iterable');
|
|
352
|
-
|
|
353
|
-
export const IIterable__iterator = Symbol.iterator;
|
|
354
|
-
|
|
355
|
-
export function _iterator(coll) {
|
|
356
|
-
return coll[Symbol.iterator]();
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
export const es6_iterator = _iterator;
|
|
360
|
-
|
|
361
|
-
export function seq(x) {
|
|
362
|
-
let iter = iterable(x);
|
|
363
|
-
// return nil for terminal checking
|
|
364
|
-
if (iter.length === 0 || iter.size === 0) {
|
|
365
|
-
return null;
|
|
366
|
-
}
|
|
367
|
-
return iter;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
export function first(coll) {
|
|
371
|
-
// destructuring uses iterable protocol
|
|
372
|
-
let [first] = iterable(coll);
|
|
373
|
-
return first;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
export function second(coll) {
|
|
377
|
-
let [_, v] = iterable(coll);
|
|
378
|
-
return v;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
export function ffirst(coll) {
|
|
382
|
-
return first(first(coll));
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
export function rest(coll) {
|
|
386
|
-
return lazy(function* () {
|
|
387
|
-
let first = true;
|
|
388
|
-
for (const x of iterable(coll)) {
|
|
389
|
-
if (first) first = false;
|
|
390
|
-
else yield x;
|
|
391
|
-
}
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
class Reduced {
|
|
396
|
-
value;
|
|
397
|
-
constructor(x) {
|
|
398
|
-
this.value = x;
|
|
399
|
-
}
|
|
400
|
-
_deref() {
|
|
401
|
-
return this.value;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
export function last(coll) {
|
|
406
|
-
coll = iterable(coll);
|
|
407
|
-
switch (typeConst(coll)) {
|
|
408
|
-
case ARRAY_TYPE:
|
|
409
|
-
return coll[coll.length - 1];
|
|
410
|
-
default:
|
|
411
|
-
let lastEl;
|
|
412
|
-
for (const x of coll) {
|
|
413
|
-
lastEl = x;
|
|
414
|
-
}
|
|
415
|
-
return lastEl;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
export function reduced(x) {
|
|
420
|
-
return new Reduced(x);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
export function reduced_QMARK_(x) {
|
|
424
|
-
return x instanceof Reduced;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
export function reduce(f, arg1, arg2) {
|
|
428
|
-
let coll, val;
|
|
429
|
-
if (arg2 === undefined) {
|
|
430
|
-
// (reduce f coll)
|
|
431
|
-
let iter = iterable(arg1)[Symbol.iterator]();
|
|
432
|
-
val = iter.next().value;
|
|
433
|
-
coll = iter;
|
|
434
|
-
} else {
|
|
435
|
-
// (reduce f val coll)
|
|
436
|
-
val = arg1;
|
|
437
|
-
coll = iterable(arg2);
|
|
438
|
-
}
|
|
439
|
-
if (val instanceof Reduced) {
|
|
440
|
-
return val.value;
|
|
441
|
-
}
|
|
442
|
-
for (const x of coll) {
|
|
443
|
-
val = f(val, x);
|
|
444
|
-
if (val instanceof Reduced) {
|
|
445
|
-
val = val.value;
|
|
446
|
-
break;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
return val;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
class LazyIterable {
|
|
453
|
-
constructor(gen) {
|
|
454
|
-
this.gen = gen;
|
|
455
|
-
}
|
|
456
|
-
[IIterable] = true;
|
|
457
|
-
[Symbol.iterator]() {
|
|
458
|
-
return this.gen();
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
export function lazy(f) {
|
|
463
|
-
return new LazyIterable(f);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
export function cons(x, coll) {
|
|
467
|
-
return lazy(function* () {
|
|
468
|
-
yield x;
|
|
469
|
-
yield* iterable(coll);
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
export function map(f, ...colls) {
|
|
474
|
-
switch (colls.length) {
|
|
475
|
-
case 0:
|
|
476
|
-
throw new Error('map with 2 arguments is not supported yet');
|
|
477
|
-
case 1:
|
|
478
|
-
return lazy(function* () {
|
|
479
|
-
for (const x of iterable(colls[0])) {
|
|
480
|
-
yield f(x);
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
default:
|
|
484
|
-
return lazy(function* () {
|
|
485
|
-
const iters = colls.map((coll) => es6_iterator(iterable(coll)));
|
|
486
|
-
while (true) {
|
|
487
|
-
let args = [];
|
|
488
|
-
for (const i of iters) {
|
|
489
|
-
const nextVal = i.next();
|
|
490
|
-
if (nextVal.done) {
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
args.push(nextVal.value);
|
|
494
|
-
}
|
|
495
|
-
yield f(...args);
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
export function filter(pred, coll) {
|
|
502
|
-
return lazy(function* () {
|
|
503
|
-
for (const x of iterable(coll)) {
|
|
504
|
-
if (pred(x)) {
|
|
505
|
-
yield x;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
export function filterv(pred, coll) {
|
|
512
|
-
return [...filter(pred, coll)];
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
export function remove(pred, coll) {
|
|
516
|
-
return filter(complement(pred), coll);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
export function map_indexed(f, coll) {
|
|
520
|
-
let ret = [];
|
|
521
|
-
let i = 0;
|
|
522
|
-
for (const x of iterable(coll)) {
|
|
523
|
-
ret.push(f(i, x));
|
|
524
|
-
i++;
|
|
525
|
-
}
|
|
526
|
-
return ret;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
export function str(...xs) {
|
|
530
|
-
return xs.join('');
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
export function not(expr) {
|
|
534
|
-
return !expr;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
export function nil_QMARK_(v) {
|
|
538
|
-
return v == null;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
export const PROTOCOL_SENTINEL = {};
|
|
542
|
-
|
|
543
|
-
function pr_str_1(x) {
|
|
544
|
-
return JSON.stringify(x, (_key, value) => {
|
|
545
|
-
switch (typeConst(value)) {
|
|
546
|
-
case SET_TYPE:
|
|
547
|
-
case LAZY_ITERABLE_TYPE:
|
|
548
|
-
return [...value];
|
|
549
|
-
case MAP_TYPE:
|
|
550
|
-
return Object.fromEntries(value);
|
|
551
|
-
default:
|
|
552
|
-
return value;
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
export function pr_str(...xs) {
|
|
558
|
-
return xs.map(pr_str_1).join(' ');
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
export function prn(...xs) {
|
|
562
|
-
println(pr_str(...xs));
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
export function Atom(init) {
|
|
566
|
-
this.val = init;
|
|
567
|
-
this._deref = () => this.val;
|
|
568
|
-
this._reset_BANG_ = (x) => (this.val = x);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
export function atom(init) {
|
|
572
|
-
return new Atom(init);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
export function deref(ref) {
|
|
576
|
-
return ref._deref();
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
export function reset_BANG_(atm, v) {
|
|
580
|
-
atm._reset_BANG_(v);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
export function swap_BANG_(atm, f, ...args) {
|
|
584
|
-
const v = f(deref(atm), ...args);
|
|
585
|
-
reset_BANG_(atm, v);
|
|
586
|
-
return v;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
export function range(begin, end, step) {
|
|
590
|
-
return lazy(function* () {
|
|
591
|
-
let b = begin,
|
|
592
|
-
e = end,
|
|
593
|
-
s = step;
|
|
594
|
-
if (end === undefined) {
|
|
595
|
-
b = 0;
|
|
596
|
-
e = begin;
|
|
597
|
-
}
|
|
598
|
-
let i = b || 0;
|
|
599
|
-
s = step || 1;
|
|
600
|
-
while (e === undefined || i < e) {
|
|
601
|
-
yield i;
|
|
602
|
-
i += s;
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
export function re_matches(re, s) {
|
|
608
|
-
let matches = re.exec(s);
|
|
609
|
-
if (matches && s === matches[0]) {
|
|
610
|
-
if (matches.length === 1) {
|
|
611
|
-
return matches[0];
|
|
612
|
-
} else {
|
|
613
|
-
return matches;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
export function subvec(arr, start, end) {
|
|
619
|
-
return arr.slice(start, end);
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
export function vector(...args) {
|
|
623
|
-
return args;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
export function vector_QMARK_(x) {
|
|
627
|
-
return typeConst(x) === ARRAY_TYPE;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
export function mapv(...args) {
|
|
631
|
-
return [...map(...args)];
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
export function vec(x) {
|
|
635
|
-
return [...iterable(x)];
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
export function set(coll) {
|
|
639
|
-
return new Set(iterable(coll));
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
export function apply(f, ...args) {
|
|
643
|
-
const xs = args.slice(0, args.length - 1);
|
|
644
|
-
const coll = args[args.length - 1];
|
|
645
|
-
return f(...xs, ...coll);
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
export function even_QMARK_(x) {
|
|
649
|
-
return x % 2 == 0;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
export function odd_QMARK_(x) {
|
|
653
|
-
return !even_QMARK_(x);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
export function complement(f) {
|
|
657
|
-
return (...args) => not(f(...args));
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
export function constantly(x) {
|
|
661
|
-
return (..._) => x;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
class List extends Array {
|
|
665
|
-
constructor(...args) {
|
|
666
|
-
super();
|
|
667
|
-
this.push(...args);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
export function list_QMARK_(x) {
|
|
672
|
-
return typeConst(x) === LIST_TYPE;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
export function list(...args) {
|
|
676
|
-
return new List(...args);
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
export function array_QMARK_(x) {
|
|
680
|
-
return x instanceof Array;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
export function concat(...colls) {
|
|
684
|
-
return lazy(function* () {
|
|
685
|
-
for (const coll of colls) {
|
|
686
|
-
yield* iterable(coll);
|
|
687
|
-
}
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
export function mapcat(f, ...colls) {
|
|
692
|
-
return concat(...map(f, ...colls));
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
export function identity(x) {
|
|
696
|
-
return x;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
export function interleave(...colls) {
|
|
700
|
-
return lazy(function* () {
|
|
701
|
-
const iters = colls.map((coll) => es6_iterator(iterable(coll)));
|
|
702
|
-
while (true) {
|
|
703
|
-
let res = [];
|
|
704
|
-
for (const i of iters) {
|
|
705
|
-
const nextVal = i.next();
|
|
706
|
-
if (nextVal.done) {
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
res.push(nextVal.value);
|
|
710
|
-
}
|
|
711
|
-
yield* res;
|
|
712
|
-
}
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
export function interpose(sep, coll) {
|
|
717
|
-
return drop(1, interleave(repeat(sep), coll));
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
export function select_keys(o, ks) {
|
|
721
|
-
const type = typeConst(o);
|
|
722
|
-
// ret could be object or array, but in the future, maybe we'll have an IEmpty protocol
|
|
723
|
-
const ret = emptyOfType(type);
|
|
724
|
-
for (const k of ks) {
|
|
725
|
-
const v = get(o, k);
|
|
726
|
-
if (v != undefined) {
|
|
727
|
-
assoc_BANG_(ret, k, v);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
return ret;
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
export function partition_all(n, ...args) {
|
|
734
|
-
let step = n,
|
|
735
|
-
coll = args[0];
|
|
736
|
-
|
|
737
|
-
if (args.length === 2) {
|
|
738
|
-
[step, coll] = args;
|
|
739
|
-
}
|
|
740
|
-
return partitionInternal(n, step, [], coll, true);
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
export function partition(n, ...args) {
|
|
744
|
-
let step = n,
|
|
745
|
-
pad = [],
|
|
746
|
-
coll = args[0];
|
|
747
|
-
|
|
748
|
-
if (args.length === 2) {
|
|
749
|
-
[step, coll] = args;
|
|
750
|
-
} else if (args.length > 2) {
|
|
751
|
-
[step, pad, coll] = args;
|
|
752
|
-
}
|
|
753
|
-
return partitionInternal(n, step, pad, coll, false);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
function partitionInternal(n, step, pad, coll, all) {
|
|
757
|
-
return lazy(function* () {
|
|
758
|
-
let p = [];
|
|
759
|
-
let i = 0;
|
|
760
|
-
for (let x of iterable(coll)) {
|
|
761
|
-
if (i < n) {
|
|
762
|
-
p.push(x);
|
|
763
|
-
if (p.length === n) {
|
|
764
|
-
yield p;
|
|
765
|
-
p = step < n ? p.slice(step) : [];
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
i++;
|
|
769
|
-
if (i === step) {
|
|
770
|
-
i = 0;
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
if (p.length > 0) {
|
|
775
|
-
if (p.length === n || all) {
|
|
776
|
-
yield p;
|
|
777
|
-
} else if (pad.length) {
|
|
778
|
-
p.push(...pad.slice(0, n - p.length));
|
|
779
|
-
yield p;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
export function empty(coll) {
|
|
786
|
-
const type = typeConst(coll);
|
|
787
|
-
return emptyOfType(type);
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
export function merge(...args) {
|
|
791
|
-
// if the first arg is nil we coerce it into a map.
|
|
792
|
-
const firstArg = args[0];
|
|
793
|
-
let obj;
|
|
794
|
-
if (firstArg === null || firstArg === undefined) {
|
|
795
|
-
obj = {};
|
|
796
|
-
} else {
|
|
797
|
-
obj = into(empty(firstArg), firstArg);
|
|
798
|
-
}
|
|
799
|
-
return conj_BANG_(obj, ...args.slice(1));
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
export function system_time() {
|
|
803
|
-
return performance.now();
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
export function into(...args) {
|
|
807
|
-
switch (args.length) {
|
|
808
|
-
case 0:
|
|
809
|
-
return [];
|
|
810
|
-
case 1:
|
|
811
|
-
return args[0];
|
|
812
|
-
default:
|
|
813
|
-
return conj(args[0] ?? [], ...iterable(args[1]));
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
export function identical_QMARK_(x, y) {
|
|
818
|
-
return x === y;
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
export function repeat(...args) {
|
|
822
|
-
if (args.length == 0 || args.length > 2) {
|
|
823
|
-
throw new Error(`Invalid arity: ${args.length}`);
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
return {
|
|
827
|
-
[IIterable]: true,
|
|
828
|
-
[IIterable__iterator]:
|
|
829
|
-
args.length == 1
|
|
830
|
-
? function* () {
|
|
831
|
-
let x = args[0];
|
|
832
|
-
while (true) yield x;
|
|
833
|
-
}
|
|
834
|
-
: function* () {
|
|
835
|
-
let [n, x] = args;
|
|
836
|
-
for (var i = 0; i < n; i++) yield x;
|
|
837
|
-
},
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
export function take(n, coll) {
|
|
842
|
-
return lazy(function* () {
|
|
843
|
-
let i = n - 1;
|
|
844
|
-
for (const x of iterable(coll)) {
|
|
845
|
-
if (i-- >= 0) {
|
|
846
|
-
yield x;
|
|
847
|
-
}
|
|
848
|
-
if (i < 0) {
|
|
849
|
-
return;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
export function take_while(pred, coll) {
|
|
856
|
-
return lazy(function* () {
|
|
857
|
-
for (const o of iterable(coll)) {
|
|
858
|
-
if (pred(o)) yield o;
|
|
859
|
-
else return;
|
|
860
|
-
}
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
export function take_nth(n, coll) {
|
|
865
|
-
if (n <= 0) {
|
|
866
|
-
return repeat(first(coll));
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
return lazy(function* () {
|
|
870
|
-
let i = 0;
|
|
871
|
-
for (let x of iterable(coll)) {
|
|
872
|
-
if (i % n === 0) {
|
|
873
|
-
yield x;
|
|
874
|
-
}
|
|
875
|
-
i++;
|
|
876
|
-
}
|
|
877
|
-
});
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
export function partial(f, ...xs) {
|
|
881
|
-
return function (...args) {
|
|
882
|
-
return f(...xs, ...args);
|
|
883
|
-
};
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
export function cycle(coll) {
|
|
887
|
-
return lazy(function* () {
|
|
888
|
-
while (true) yield* coll;
|
|
889
|
-
});
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
export function drop(n, xs) {
|
|
893
|
-
return lazy(function* () {
|
|
894
|
-
let iter = _iterator(iterable(xs));
|
|
895
|
-
for (let x = 0; x < n; x++) {
|
|
896
|
-
iter.next();
|
|
897
|
-
}
|
|
898
|
-
yield* iter;
|
|
899
|
-
});
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
export function drop_while(pred, xs) {
|
|
903
|
-
return lazy(function* () {
|
|
904
|
-
let iter = _iterator(iterable(xs));
|
|
905
|
-
while (true) {
|
|
906
|
-
let nextItem = iter.next();
|
|
907
|
-
if (nextItem.done) {
|
|
908
|
-
break;
|
|
909
|
-
}
|
|
910
|
-
let value = nextItem.value;
|
|
911
|
-
if (!pred(value)) {
|
|
912
|
-
yield value;
|
|
913
|
-
break;
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
yield* iter;
|
|
917
|
-
});
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
export function distinct(coll) {
|
|
921
|
-
return lazy(function* () {
|
|
922
|
-
let seen = new Set();
|
|
923
|
-
for (const x of iterable(coll)) {
|
|
924
|
-
if (!seen.has(x)) yield x;
|
|
925
|
-
seen.add(x);
|
|
926
|
-
}
|
|
927
|
-
return;
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
export function update(coll, k, f, ...args) {
|
|
932
|
-
return assoc(coll, k, f(get(coll, k), ...args));
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
export function get_in(coll, path, orElse) {
|
|
936
|
-
let entry = coll;
|
|
937
|
-
for (const item of path) {
|
|
938
|
-
entry = get(entry, item);
|
|
939
|
-
}
|
|
940
|
-
if (entry === undefined) return orElse;
|
|
941
|
-
return entry;
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
export function update_in(coll, path, f, ...args) {
|
|
945
|
-
return assoc_in(coll, path, f(get_in(coll, path), ...args));
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
export function fnil(f, x, ...xs) {
|
|
949
|
-
return function (a, ...args) {
|
|
950
|
-
if (!a) {
|
|
951
|
-
return f(x, ...xs, ...args);
|
|
952
|
-
} else {
|
|
953
|
-
return f(a, ...xs, ...args);
|
|
954
|
-
}
|
|
955
|
-
};
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
export function every_QMARK_(pred, coll) {
|
|
959
|
-
for (let x of iterable(coll)) {
|
|
960
|
-
if (!pred(x)) return false;
|
|
961
|
-
}
|
|
962
|
-
return true;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
export function not_every_QMARK_(pred, coll) {
|
|
966
|
-
return !every_QMARK_(pred, coll);
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
export function keep(pred, coll) {
|
|
970
|
-
return lazy(function* () {
|
|
971
|
-
for (const o of iterable(coll)) {
|
|
972
|
-
const res = pred(o);
|
|
973
|
-
if (res) yield res;
|
|
974
|
-
}
|
|
975
|
-
});
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
export function reverse(coll) {
|
|
979
|
-
if (coll instanceof Array) {
|
|
980
|
-
// performance: we don't need to copy to another array first
|
|
981
|
-
return coll.reverse();
|
|
982
|
-
} else return [...coll].reverse();
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
export function sort(f, coll) {
|
|
986
|
-
if (coll === undefined) {
|
|
987
|
-
coll = f;
|
|
988
|
-
f = undefined;
|
|
989
|
-
}
|
|
990
|
-
return [...coll].sort(f);
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
export function shuffle(coll) {
|
|
994
|
-
return [...coll].sort(function (a, b) {
|
|
995
|
-
return Math.random() - 0.5;
|
|
996
|
-
});
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
export function some(pred, coll) {
|
|
1000
|
-
for (const o of iterable(coll)) {
|
|
1001
|
-
const res = pred(o);
|
|
1002
|
-
if (res) return res;
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
export function not_any_QMARK_(pred, coll) {
|
|
1007
|
-
return !some(pred, coll);
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
export function replace(smap, coll) {
|
|
1011
|
-
let mapf = coll instanceof Array ? mapv : map;
|
|
1012
|
-
return mapf((x) => {
|
|
1013
|
-
const repl = smap[x];
|
|
1014
|
-
if (repl !== undefined) {
|
|
1015
|
-
return repl;
|
|
1016
|
-
} else {
|
|
1017
|
-
return x;
|
|
1018
|
-
}
|
|
1019
|
-
}, coll);
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
export function empty_QMARK_(coll) {
|
|
1023
|
-
return seq(coll) ? false : true;
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
export function rand_int(n) {
|
|
1027
|
-
return Math.floor(Math.random() * n);
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
function _repeatedly(f) {
|
|
1031
|
-
return lazy(function* () {
|
|
1032
|
-
while (true) yield f();
|
|
1033
|
-
});
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
export function repeatedly(n, f) {
|
|
1037
|
-
if (f === undefined) {
|
|
1038
|
-
f = n;
|
|
1039
|
-
n = undefined;
|
|
1040
|
-
}
|
|
1041
|
-
const res = _repeatedly(f);
|
|
1042
|
-
if (n) {
|
|
1043
|
-
return take(n, res);
|
|
1044
|
-
} else {
|
|
1045
|
-
return res;
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
export function update_BANG_(m, k, f, ...args) {
|
|
1050
|
-
const v = get(m, k);
|
|
1051
|
-
return assoc_BANG_(m, k, f(v, ...args));
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
export function group_by(f, coll) {
|
|
1055
|
-
const res = {};
|
|
1056
|
-
for (const o of iterable(coll)) {
|
|
1057
|
-
const key = f(o);
|
|
1058
|
-
update_BANG_(res, key, fnil(conj_BANG_, []), o);
|
|
1059
|
-
}
|
|
1060
|
-
return res;
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
export function frequencies(coll) {
|
|
1064
|
-
const res = {};
|
|
1065
|
-
const uf = fnil(inc, 0);
|
|
1066
|
-
for (const o of iterable(coll)) {
|
|
1067
|
-
update_BANG_(res, o, uf);
|
|
1068
|
-
}
|
|
1069
|
-
return res;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
export class LazySeq {
|
|
1073
|
-
constructor(f) {
|
|
1074
|
-
this.f = f;
|
|
1075
|
-
}
|
|
1076
|
-
*[Symbol.iterator]() {
|
|
1077
|
-
yield* this.f();
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
export function butlast(coll) {
|
|
1082
|
-
let x = [...iterable(coll)];
|
|
1083
|
-
x.pop();
|
|
1084
|
-
return x.length > 0 ? x : null;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
export function drop_last(...args) {
|
|
1088
|
-
let [n, coll] = args.length > 1 ? args : [1, args[0]];
|
|
1089
|
-
return map((x, _) => x, coll, drop(n, coll));
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
export function split_at(n, coll) {
|
|
1093
|
-
return [take(n, coll), drop(n, coll)];
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
export function split_with(pred, coll) {
|
|
1097
|
-
return [take_while(pred, coll), drop_while(pred, coll)];
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
export function count(coll) {
|
|
1101
|
-
if (!coll) return 0;
|
|
1102
|
-
const len = coll.length || coll.size;
|
|
1103
|
-
if (typeof len === 'number') {
|
|
1104
|
-
return len;
|
|
1105
|
-
}
|
|
1106
|
-
let ret = 0;
|
|
1107
|
-
for (const o of iterable(coll)) {
|
|
1108
|
-
ret++;
|
|
1109
|
-
}
|
|
1110
|
-
return ret;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
export function true_QMARK_(x) {
|
|
1114
|
-
return x === true;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
export function false_QMARK_(x) {
|
|
1118
|
-
return x === false;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
export function some_QMARK_(x) {
|
|
1122
|
-
return !(x === null || x === undefined);
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
export function boolean$(x) {
|
|
1126
|
-
return !!x;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
export function zero_QMARK_(x) {
|
|
1130
|
-
return x === 0;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
export function neg_QMARK_(x) {
|
|
1134
|
-
return x < 0;
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
export function pos_QMARK_(x) {
|
|
1138
|
-
return x > 0;
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
export function js_obj(...args) {
|
|
1142
|
-
var ctr = 0;
|
|
1143
|
-
let ret = {};
|
|
1144
|
-
while (true) {
|
|
1145
|
-
if (ctr >= args.length) {
|
|
1146
|
-
break;
|
|
1147
|
-
}
|
|
1148
|
-
ret[args[ctr]]=args[ctr+1];
|
|
1149
|
-
ctr = ctr + 2;
|
|
1150
|
-
}
|
|
1151
|
-
return ret;
|
|
1152
|
-
}
|
|
1
|
+
export * from './src/squint/core.js';
|