@mojir/lits 2.5.1 → 2.6.1
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/README.md +10 -11
- package/dist/cli/cli.js +2150 -1202
- package/dist/cli/reference/api.d.ts +15 -11
- package/dist/cli/reference/index.d.ts +133 -132
- package/dist/cli/src/builtin/bindingNode.d.ts +5 -0
- package/dist/cli/src/builtin/core/assertion.d.ts +2 -0
- package/dist/cli/src/builtin/index.d.ts +2 -2
- package/dist/cli/src/builtin/interface.d.ts +2 -1
- package/dist/cli/src/builtin/modules/convert/index.d.ts +2 -0
- package/dist/cli/src/builtin/specialExpressionTypes.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/match.d.ts +7 -0
- package/dist/cli/src/parser/subParsers/parseBindingTarget.d.ts +4 -2
- package/dist/cli/src/parser/subParsers/parseMatch.d.ts +4 -0
- package/dist/cli/src/parser/types.d.ts +5 -1
- package/dist/full.esm.js +1 -1
- package/dist/full.esm.js.map +1 -1
- package/dist/full.js +1 -1
- package/dist/full.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +1 -1
- package/dist/lits.iife.js.map +1 -1
- package/dist/modules/assertion.esm.js +2 -0
- package/dist/modules/assertion.esm.js.map +1 -0
- package/dist/modules/assertion.js +2 -0
- package/dist/modules/assertion.js.map +1 -0
- package/dist/modules/collection.esm.js +1 -1
- package/dist/modules/collection.esm.js.map +1 -1
- package/dist/modules/collection.js +1 -1
- package/dist/modules/collection.js.map +1 -1
- package/dist/modules/convert.esm.js +2 -0
- package/dist/modules/convert.esm.js.map +1 -0
- package/dist/modules/convert.js +2 -0
- package/dist/modules/convert.js.map +1 -0
- package/dist/modules/grid.esm.js +1 -1
- package/dist/modules/grid.esm.js.map +1 -1
- package/dist/modules/grid.js +1 -1
- package/dist/modules/grid.js.map +1 -1
- package/dist/modules/linear-algebra.esm.js +1 -1
- package/dist/modules/linear-algebra.esm.js.map +1 -1
- package/dist/modules/linear-algebra.js +1 -1
- package/dist/modules/linear-algebra.js.map +1 -1
- package/dist/modules/math.esm.js +1 -1
- package/dist/modules/math.esm.js.map +1 -1
- package/dist/modules/math.js +1 -1
- package/dist/modules/math.js.map +1 -1
- package/dist/modules/matrix.esm.js +1 -1
- package/dist/modules/matrix.esm.js.map +1 -1
- package/dist/modules/matrix.js +1 -1
- package/dist/modules/matrix.js.map +1 -1
- package/dist/modules/random.esm.js +1 -1
- package/dist/modules/random.esm.js.map +1 -1
- package/dist/modules/random.js +1 -1
- package/dist/modules/random.js.map +1 -1
- package/dist/modules/reference/api.d.ts +15 -11
- package/dist/modules/reference/index.d.ts +133 -132
- package/dist/modules/sequence.esm.js +1 -1
- package/dist/modules/sequence.esm.js.map +1 -1
- package/dist/modules/sequence.js +1 -1
- package/dist/modules/sequence.js.map +1 -1
- package/dist/modules/src/builtin/bindingNode.d.ts +5 -0
- package/dist/modules/src/builtin/core/assertion.d.ts +2 -0
- package/dist/modules/src/builtin/index.d.ts +2 -2
- package/dist/modules/src/builtin/interface.d.ts +2 -1
- package/dist/modules/src/builtin/modules/convert/index.d.ts +2 -0
- package/dist/modules/src/builtin/specialExpressionTypes.d.ts +1 -1
- package/dist/modules/src/builtin/specialExpressions/match.d.ts +7 -0
- package/dist/modules/src/full.d.ts +1 -1
- package/dist/modules/src/modules/assertion.d.ts +2 -0
- package/dist/modules/src/modules/{assert.d.ts → convert.d.ts} +1 -1
- package/dist/modules/src/parser/subParsers/parseBindingTarget.d.ts +4 -2
- package/dist/modules/src/parser/subParsers/parseMatch.d.ts +4 -0
- package/dist/modules/src/parser/types.d.ts +5 -1
- package/dist/modules/string.esm.js +1 -1
- package/dist/modules/string.esm.js.map +1 -1
- package/dist/modules/string.js +1 -1
- package/dist/modules/string.js.map +1 -1
- package/dist/modules/vector.esm.js +1 -1
- package/dist/modules/vector.esm.js.map +1 -1
- package/dist/modules/vector.js +1 -1
- package/dist/modules/vector.js.map +1 -1
- package/dist/reference/api.d.ts +15 -11
- package/dist/reference/index.d.ts +133 -132
- package/dist/src/builtin/bindingNode.d.ts +5 -0
- package/dist/src/builtin/core/assertion.d.ts +2 -0
- package/dist/src/builtin/index.d.ts +2 -2
- package/dist/src/builtin/interface.d.ts +2 -1
- package/dist/src/builtin/modules/convert/index.d.ts +2 -0
- package/dist/src/builtin/specialExpressionTypes.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/match.d.ts +7 -0
- package/dist/src/full.d.ts +1 -1
- package/dist/src/modules/assertion.d.ts +2 -0
- package/dist/src/modules/{assert.d.ts → convert.d.ts} +1 -1
- package/dist/src/parser/subParsers/parseBindingTarget.d.ts +4 -2
- package/dist/src/parser/subParsers/parseMatch.d.ts +4 -0
- package/dist/src/parser/types.d.ts +5 -1
- package/dist/testFramework.esm.js +1 -1
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +1 -1
- package/dist/testFramework.js.map +1 -1
- package/package.json +10 -5
- package/dist/cli/src/builtin/specialExpressions/switch.d.ts +0 -6
- package/dist/cli/src/parser/subParsers/parseSwitch.d.ts +0 -4
- package/dist/modules/assert.esm.js +0 -2
- package/dist/modules/assert.esm.js.map +0 -1
- package/dist/modules/assert.js +0 -2
- package/dist/modules/assert.js.map +0 -1
- package/dist/modules/src/builtin/specialExpressions/switch.d.ts +0 -6
- package/dist/modules/src/parser/subParsers/parseSwitch.d.ts +0 -4
- package/dist/src/builtin/specialExpressions/switch.d.ts +0 -6
- package/dist/src/parser/subParsers/parseSwitch.d.ts +0 -4
- /package/dist/cli/src/builtin/modules/{assert → assertion}/docs.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{assert → assertion}/index.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{assert → assertion}/docs.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{assert → assertion}/index.d.ts +0 -0
- /package/dist/src/builtin/modules/{assert → assertion}/docs.d.ts +0 -0
- /package/dist/src/builtin/modules/{assert → assertion}/index.d.ts +0 -0
package/dist/cli/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ var readline = require('node:readline');
|
|
|
7
7
|
var os = require('node:os');
|
|
8
8
|
var process$1 = require('node:process');
|
|
9
9
|
|
|
10
|
-
var version = "2.
|
|
10
|
+
var version = "2.6.1";
|
|
11
11
|
|
|
12
12
|
function getCodeMarker(sourceCodeInfo) {
|
|
13
13
|
if (!sourceCodeInfo.position || !sourceCodeInfo.code)
|
|
@@ -98,7 +98,7 @@ const specialExpressionTypes = {
|
|
|
98
98
|
'loop': 12,
|
|
99
99
|
'object': 13,
|
|
100
100
|
'recur': 14,
|
|
101
|
-
'
|
|
101
|
+
'match': 15,
|
|
102
102
|
'throw': 16,
|
|
103
103
|
'try': 17,
|
|
104
104
|
'unless': 18,
|
|
@@ -289,85 +289,6 @@ function findUnresolvedSymbolsInNode(node, contextStack, builtin, evaluateNode)
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
function getRangeString(options) {
|
|
293
|
-
const hasUpperAndLowerBound = (typeof options.gt === 'number' || typeof options.gte === 'number')
|
|
294
|
-
&& (typeof options.lt === 'number' || typeof options.lte === 'number');
|
|
295
|
-
if (hasUpperAndLowerBound) {
|
|
296
|
-
return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`}`;
|
|
297
|
-
}
|
|
298
|
-
else if (typeof options.gt === 'number' || typeof options.gte === 'number') {
|
|
299
|
-
return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`;
|
|
300
|
-
}
|
|
301
|
-
else if (typeof options.lt === 'number' || typeof options.lte === 'number') {
|
|
302
|
-
return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`;
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
return '';
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
function getSignString(options) {
|
|
309
|
-
return options.positive
|
|
310
|
-
? 'positive'
|
|
311
|
-
: options.negative
|
|
312
|
-
? 'negative'
|
|
313
|
-
: options.nonNegative
|
|
314
|
-
? 'non negative'
|
|
315
|
-
: options.nonPositive
|
|
316
|
-
? 'non positive'
|
|
317
|
-
: options.nonZero
|
|
318
|
-
? 'non zero'
|
|
319
|
-
: '';
|
|
320
|
-
}
|
|
321
|
-
function getNumberTypeName(options) {
|
|
322
|
-
if (options.zero)
|
|
323
|
-
return 'zero';
|
|
324
|
-
const sign = getSignString(options);
|
|
325
|
-
const numberType = options.integer ? 'integer' : 'number';
|
|
326
|
-
const finite = options.finite ? 'finite' : '';
|
|
327
|
-
const range = getRangeString(options);
|
|
328
|
-
return [sign, finite, numberType, range].filter(x => !!x).join(' ');
|
|
329
|
-
}
|
|
330
|
-
function isNumber(value, options = {}) {
|
|
331
|
-
if (typeof value !== 'number')
|
|
332
|
-
return false;
|
|
333
|
-
if (Number.isNaN(value))
|
|
334
|
-
return false;
|
|
335
|
-
if (options.integer && !Number.isInteger(value))
|
|
336
|
-
return false;
|
|
337
|
-
if (options.finite && !Number.isFinite(value))
|
|
338
|
-
return false;
|
|
339
|
-
if (options.zero && value !== 0)
|
|
340
|
-
return false;
|
|
341
|
-
if (options.nonZero && value === 0)
|
|
342
|
-
return false;
|
|
343
|
-
if (options.positive && value <= 0)
|
|
344
|
-
return false;
|
|
345
|
-
if (options.negative && value >= 0)
|
|
346
|
-
return false;
|
|
347
|
-
if (options.nonPositive && value > 0)
|
|
348
|
-
return false;
|
|
349
|
-
if (options.nonNegative && value < 0)
|
|
350
|
-
return false;
|
|
351
|
-
if (typeof options.gt === 'number' && value <= options.gt)
|
|
352
|
-
return false;
|
|
353
|
-
if (typeof options.gte === 'number' && value < options.gte)
|
|
354
|
-
return false;
|
|
355
|
-
if (typeof options.lt === 'number' && value >= options.lt)
|
|
356
|
-
return false;
|
|
357
|
-
if (typeof options.lte === 'number' && value > options.lte)
|
|
358
|
-
return false;
|
|
359
|
-
return true;
|
|
360
|
-
}
|
|
361
|
-
function assertNumber(value, sourceCodeInfo, options = {}) {
|
|
362
|
-
if (!isNumber(value, options)) {
|
|
363
|
-
throw new LitsError(`Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo));
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
function asNumber(value, sourceCodeInfo, options = {}) {
|
|
367
|
-
assertNumber(value, sourceCodeInfo, options);
|
|
368
|
-
return value;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
292
|
function isNonUndefined(value) {
|
|
372
293
|
return value !== undefined;
|
|
373
294
|
}
|
|
@@ -474,6 +395,162 @@ function assertFunctionLike(value, sourceCodeInfo) {
|
|
|
474
395
|
throw getAssertionError('FunctionLike', value, sourceCodeInfo);
|
|
475
396
|
}
|
|
476
397
|
|
|
398
|
+
function isString(value, options = {}) {
|
|
399
|
+
if (typeof value !== 'string')
|
|
400
|
+
return false;
|
|
401
|
+
if (options.nonEmpty && value.length === 0)
|
|
402
|
+
return false;
|
|
403
|
+
if (options.char && value.length !== 1)
|
|
404
|
+
return false;
|
|
405
|
+
return true;
|
|
406
|
+
}
|
|
407
|
+
function assertString(value, sourceCodeInfo, options = {}) {
|
|
408
|
+
if (!isString(value, options)) {
|
|
409
|
+
throw getAssertionError(`${options.nonEmpty ? 'non empty string' : options.char ? 'character' : 'string'}`, value, sourceCodeInfo);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
function asString(value, sourceCodeInfo, options = {}) {
|
|
413
|
+
assertString(value, sourceCodeInfo, options);
|
|
414
|
+
return value;
|
|
415
|
+
}
|
|
416
|
+
function isStringOrNumber(value) {
|
|
417
|
+
return typeof value === 'string' || typeof value === 'number';
|
|
418
|
+
}
|
|
419
|
+
function asStringOrNumber(value, sourceCodeInfo) {
|
|
420
|
+
assertStringOrNumber(value, sourceCodeInfo);
|
|
421
|
+
return value;
|
|
422
|
+
}
|
|
423
|
+
function assertStringOrNumber(value, sourceCodeInfo) {
|
|
424
|
+
if (!isStringOrNumber(value))
|
|
425
|
+
throw getAssertionError('string or number', value, sourceCodeInfo);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
const assertionNormalExpression = {
|
|
429
|
+
assert: {
|
|
430
|
+
evaluate: (params, sourceCodeInfo) => {
|
|
431
|
+
const value = params[0];
|
|
432
|
+
const message = params.length === 2 ? params[1] : `${value}`;
|
|
433
|
+
assertString(message, sourceCodeInfo);
|
|
434
|
+
if (!value)
|
|
435
|
+
throw new AssertionError(message, sourceCodeInfo);
|
|
436
|
+
return asAny(value, sourceCodeInfo);
|
|
437
|
+
},
|
|
438
|
+
arity: { min: 1, max: 2 },
|
|
439
|
+
docs: {
|
|
440
|
+
category: 'assertion',
|
|
441
|
+
description: 'If $value is falsy it throws `AssertionError` with $message. If no $message is provided, message is set to $value.',
|
|
442
|
+
returns: {
|
|
443
|
+
type: 'any',
|
|
444
|
+
},
|
|
445
|
+
args: {
|
|
446
|
+
value: {
|
|
447
|
+
type: 'any',
|
|
448
|
+
},
|
|
449
|
+
message: {
|
|
450
|
+
type: 'string',
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
variants: [
|
|
454
|
+
{
|
|
455
|
+
argumentNames: [
|
|
456
|
+
'value',
|
|
457
|
+
],
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
argumentNames: [
|
|
461
|
+
'value',
|
|
462
|
+
'message',
|
|
463
|
+
],
|
|
464
|
+
},
|
|
465
|
+
],
|
|
466
|
+
examples: [
|
|
467
|
+
'try assert(0, "Expected a positive value") catch (e) e.message end',
|
|
468
|
+
],
|
|
469
|
+
seeAlso: ['assertion.assert-truthy', 'assertion.assert-true'],
|
|
470
|
+
hideOperatorForm: true,
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
function getRangeString(options) {
|
|
476
|
+
const hasUpperAndLowerBound = (typeof options.gt === 'number' || typeof options.gte === 'number')
|
|
477
|
+
&& (typeof options.lt === 'number' || typeof options.lte === 'number');
|
|
478
|
+
if (hasUpperAndLowerBound) {
|
|
479
|
+
return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`}`;
|
|
480
|
+
}
|
|
481
|
+
else if (typeof options.gt === 'number' || typeof options.gte === 'number') {
|
|
482
|
+
return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`;
|
|
483
|
+
}
|
|
484
|
+
else if (typeof options.lt === 'number' || typeof options.lte === 'number') {
|
|
485
|
+
return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`;
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
return '';
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function getSignString(options) {
|
|
492
|
+
return options.positive
|
|
493
|
+
? 'positive'
|
|
494
|
+
: options.negative
|
|
495
|
+
? 'negative'
|
|
496
|
+
: options.nonNegative
|
|
497
|
+
? 'non negative'
|
|
498
|
+
: options.nonPositive
|
|
499
|
+
? 'non positive'
|
|
500
|
+
: options.nonZero
|
|
501
|
+
? 'non zero'
|
|
502
|
+
: '';
|
|
503
|
+
}
|
|
504
|
+
function getNumberTypeName(options) {
|
|
505
|
+
if (options.zero)
|
|
506
|
+
return 'zero';
|
|
507
|
+
const sign = getSignString(options);
|
|
508
|
+
const numberType = options.integer ? 'integer' : 'number';
|
|
509
|
+
const finite = options.finite ? 'finite' : '';
|
|
510
|
+
const range = getRangeString(options);
|
|
511
|
+
return [sign, finite, numberType, range].filter(x => !!x).join(' ');
|
|
512
|
+
}
|
|
513
|
+
function isNumber(value, options = {}) {
|
|
514
|
+
if (typeof value !== 'number')
|
|
515
|
+
return false;
|
|
516
|
+
if (Number.isNaN(value))
|
|
517
|
+
return false;
|
|
518
|
+
if (options.integer && !Number.isInteger(value))
|
|
519
|
+
return false;
|
|
520
|
+
if (options.finite && !Number.isFinite(value))
|
|
521
|
+
return false;
|
|
522
|
+
if (options.zero && value !== 0)
|
|
523
|
+
return false;
|
|
524
|
+
if (options.nonZero && value === 0)
|
|
525
|
+
return false;
|
|
526
|
+
if (options.positive && value <= 0)
|
|
527
|
+
return false;
|
|
528
|
+
if (options.negative && value >= 0)
|
|
529
|
+
return false;
|
|
530
|
+
if (options.nonPositive && value > 0)
|
|
531
|
+
return false;
|
|
532
|
+
if (options.nonNegative && value < 0)
|
|
533
|
+
return false;
|
|
534
|
+
if (typeof options.gt === 'number' && value <= options.gt)
|
|
535
|
+
return false;
|
|
536
|
+
if (typeof options.gte === 'number' && value < options.gte)
|
|
537
|
+
return false;
|
|
538
|
+
if (typeof options.lt === 'number' && value >= options.lt)
|
|
539
|
+
return false;
|
|
540
|
+
if (typeof options.lte === 'number' && value > options.lte)
|
|
541
|
+
return false;
|
|
542
|
+
return true;
|
|
543
|
+
}
|
|
544
|
+
function assertNumber(value, sourceCodeInfo, options = {}) {
|
|
545
|
+
if (!isNumber(value, options)) {
|
|
546
|
+
throw new LitsError(`Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo));
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
function asNumber(value, sourceCodeInfo, options = {}) {
|
|
550
|
+
assertNumber(value, sourceCodeInfo, options);
|
|
551
|
+
return value;
|
|
552
|
+
}
|
|
553
|
+
|
|
477
554
|
function arityAcceptsMin(arity, nbrOfParams) {
|
|
478
555
|
const { min } = arity;
|
|
479
556
|
if (typeof min === 'number' && nbrOfParams < min) {
|
|
@@ -685,36 +762,6 @@ const bitwiseNormalExpression = {
|
|
|
685
762
|
},
|
|
686
763
|
};
|
|
687
764
|
|
|
688
|
-
function isString(value, options = {}) {
|
|
689
|
-
if (typeof value !== 'string')
|
|
690
|
-
return false;
|
|
691
|
-
if (options.nonEmpty && value.length === 0)
|
|
692
|
-
return false;
|
|
693
|
-
if (options.char && value.length !== 1)
|
|
694
|
-
return false;
|
|
695
|
-
return true;
|
|
696
|
-
}
|
|
697
|
-
function assertString(value, sourceCodeInfo, options = {}) {
|
|
698
|
-
if (!isString(value, options)) {
|
|
699
|
-
throw getAssertionError(`${options.nonEmpty ? 'non empty string' : options.char ? 'character' : 'string'}`, value, sourceCodeInfo);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
function asString(value, sourceCodeInfo, options = {}) {
|
|
703
|
-
assertString(value, sourceCodeInfo, options);
|
|
704
|
-
return value;
|
|
705
|
-
}
|
|
706
|
-
function isStringOrNumber(value) {
|
|
707
|
-
return typeof value === 'string' || typeof value === 'number';
|
|
708
|
-
}
|
|
709
|
-
function asStringOrNumber(value, sourceCodeInfo) {
|
|
710
|
-
assertStringOrNumber(value, sourceCodeInfo);
|
|
711
|
-
return value;
|
|
712
|
-
}
|
|
713
|
-
function assertStringOrNumber(value, sourceCodeInfo) {
|
|
714
|
-
if (!isStringOrNumber(value))
|
|
715
|
-
throw getAssertionError('string or number', value, sourceCodeInfo);
|
|
716
|
-
}
|
|
717
|
-
|
|
718
765
|
function collHasKey(coll, key) {
|
|
719
766
|
if (!isColl(coll))
|
|
720
767
|
return false;
|
|
@@ -1224,7 +1271,7 @@ filter(
|
|
|
1224
1271
|
},
|
|
1225
1272
|
variants: [{ argumentNames: ['colls', 'fun'] }],
|
|
1226
1273
|
description: 'Creates a new collection populated with the results of calling $fun on every element in $colls.',
|
|
1227
|
-
seeAlso: ['collection.mapi', 'filter', 'reduce', 'mapcat', 'grid.map', 'grid.mapi'],
|
|
1274
|
+
seeAlso: ['collection.mapi', 'filter', 'reduce', 'mapcat', 'grid.cell-map', 'grid.cell-mapi'],
|
|
1228
1275
|
examples: [
|
|
1229
1276
|
'[1, 2, 3] map -',
|
|
1230
1277
|
'[1, 2, 3] map -> -($)',
|
|
@@ -1275,7 +1322,7 @@ filter(
|
|
|
1275
1322
|
},
|
|
1276
1323
|
variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],
|
|
1277
1324
|
description: 'Runs $fun function on each element of the $coll, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value.',
|
|
1278
|
-
seeAlso: ['collection.reduce-right', 'collection.reducei', 'collection.reductions', 'map', 'grid.reduce', 'grid.reducei'],
|
|
1325
|
+
seeAlso: ['collection.reduce-right', 'collection.reducei', 'collection.reductions', 'map', 'grid.cell-reduce', 'grid.cell-reducei'],
|
|
1279
1326
|
examples: [
|
|
1280
1327
|
'reduce([1, 2, 3], +, 0)',
|
|
1281
1328
|
'reduce([], +, 0)',
|
|
@@ -1655,7 +1702,7 @@ range(
|
|
|
1655
1702
|
},
|
|
1656
1703
|
variants: [{ argumentNames: ['a', 'b'] }],
|
|
1657
1704
|
description: 'Returns an array with $a repeated $b times.',
|
|
1658
|
-
seeAlso: ['range', '
|
|
1705
|
+
seeAlso: ['range', 'string.string-repeat'],
|
|
1659
1706
|
examples: [
|
|
1660
1707
|
'repeat(10, 3)',
|
|
1661
1708
|
'repeat(10, 0)',
|
|
@@ -1904,7 +1951,7 @@ const sequenceNormalExpression = {
|
|
|
1904
1951
|
args: { seq: { type: 'sequence' } },
|
|
1905
1952
|
variants: [{ argumentNames: ['seq'] }],
|
|
1906
1953
|
description: 'Returns a copy of $seq with last element removed. If $seq is empty `null` is returned.',
|
|
1907
|
-
seeAlso: ['push', '
|
|
1954
|
+
seeAlso: ['push', 'last'],
|
|
1908
1955
|
examples: [
|
|
1909
1956
|
'pop([1, 2, 3])',
|
|
1910
1957
|
'pop([])',
|
|
@@ -2004,7 +2051,7 @@ l`,
|
|
|
2004
2051
|
description: `If $seq is an array, returns a new array with all but the first element from $seq.
|
|
2005
2052
|
If $seq has less than two elements, an empty array is returned.
|
|
2006
2053
|
For string $seq returns all but the first characters in $seq.`,
|
|
2007
|
-
seeAlso: ['next', 'first'
|
|
2054
|
+
seeAlso: ['next', 'first'],
|
|
2008
2055
|
examples: [
|
|
2009
2056
|
'rest(["Albert", "Mojir", 160, [1, 2]])',
|
|
2010
2057
|
'rest(["Albert"])',
|
|
@@ -4379,7 +4426,7 @@ const predicatesNormalExpression = {
|
|
|
4379
4426
|
args: { x: { type: 'any' } },
|
|
4380
4427
|
variants: [{ argumentNames: ['x'] }],
|
|
4381
4428
|
description: 'Returns `true` if $x is a regexp, otherwise `false`.',
|
|
4382
|
-
seeAlso: ['regexp', 'match', 'string?', 'function?'],
|
|
4429
|
+
seeAlso: ['regexp', 're-match', 'string?', 'function?'],
|
|
4383
4430
|
examples: [
|
|
4384
4431
|
'regexp?(regexp("^start"))',
|
|
4385
4432
|
'regexp?(#"^start")',
|
|
@@ -4649,11 +4696,11 @@ const regexpNormalExpression = {
|
|
|
4649
4696
|
'regexp("albert", "ig")',
|
|
4650
4697
|
'#"albert"ig',
|
|
4651
4698
|
],
|
|
4652
|
-
seeAlso: ['-short-regexp', 'match', 'replace', 'replace-all', 'regexp?'],
|
|
4699
|
+
seeAlso: ['-short-regexp', 're-match', 'replace', 'replace-all', 'regexp?'],
|
|
4653
4700
|
hideOperatorForm: true,
|
|
4654
4701
|
},
|
|
4655
4702
|
},
|
|
4656
|
-
'match': {
|
|
4703
|
+
're-match': {
|
|
4657
4704
|
evaluate: ([text, regexp], sourceCodeInfo) => {
|
|
4658
4705
|
assertRegularExpression(regexp, sourceCodeInfo);
|
|
4659
4706
|
if (!isString(text))
|
|
@@ -4674,16 +4721,16 @@ const regexpNormalExpression = {
|
|
|
4674
4721
|
},
|
|
4675
4722
|
variants: [{ argumentNames: ['a', 'b'] }],
|
|
4676
4723
|
description: `Matches $b against regular expression $a.
|
|
4677
|
-
If $b is a string and matches the regular expression, a \`match\`-array is returned, otherwise \`null\` is returned.`,
|
|
4724
|
+
If $b is a string and matches the regular expression, a \`re-match\`-array is returned, otherwise \`null\` is returned.`,
|
|
4678
4725
|
seeAlso: ['regexp', 'replace', 'replace-all', '-short-regexp', 'regexp?'],
|
|
4679
4726
|
examples: [
|
|
4680
|
-
'match(" A string", regexp("^\\\\s*(.*)$"))',
|
|
4681
|
-
'match(" A string", #"^\\s*(.*)$")',
|
|
4682
|
-
'match("My name is Albert", #"albert"i)',
|
|
4683
|
-
'match("My name is Ben", #"albert"i)',
|
|
4684
|
-
'match(null, #"albert"i)',
|
|
4685
|
-
'match(1, #"albert"i)',
|
|
4686
|
-
'match({}, #"albert"i)',
|
|
4727
|
+
're-match(" A string", regexp("^\\\\s*(.*)$"))',
|
|
4728
|
+
're-match(" A string", #"^\\s*(.*)$")',
|
|
4729
|
+
're-match("My name is Albert", #"albert"i)',
|
|
4730
|
+
're-match("My name is Ben", #"albert"i)',
|
|
4731
|
+
're-match(null, #"albert"i)',
|
|
4732
|
+
're-match(1, #"albert"i)',
|
|
4733
|
+
're-match({}, #"albert"i)',
|
|
4687
4734
|
],
|
|
4688
4735
|
},
|
|
4689
4736
|
},
|
|
@@ -4706,7 +4753,7 @@ If $b is a string and matches the regular expression, a \`match\`-array is retur
|
|
|
4706
4753
|
},
|
|
4707
4754
|
variants: [{ argumentNames: ['a', 'b', 'x'] }],
|
|
4708
4755
|
description: 'Returns a new string with first match of regular expression $b replaced by $x.',
|
|
4709
|
-
seeAlso: ['replace-all', 'regexp', 'match', '-short-regexp'],
|
|
4756
|
+
seeAlso: ['replace-all', 'regexp', 're-match', '-short-regexp'],
|
|
4710
4757
|
examples: [
|
|
4711
4758
|
'replace("Duck duck", "u", "i")',
|
|
4712
4759
|
'replace("Duck duck", #"u", "i")',
|
|
@@ -4736,7 +4783,7 @@ If $b is a string and matches the regular expression, a \`match\`-array is retur
|
|
|
4736
4783
|
},
|
|
4737
4784
|
variants: [{ argumentNames: ['a', 'b', 'x'] }],
|
|
4738
4785
|
description: 'Returns a new string with all matches of regular expression $b replaced by $x.',
|
|
4739
|
-
seeAlso: ['replace', 'regexp', 'match', '-short-regexp'],
|
|
4786
|
+
seeAlso: ['replace', 'regexp', 're-match', '-short-regexp'],
|
|
4740
4787
|
examples: [
|
|
4741
4788
|
'replace-all("Duck duck", "u", "i")',
|
|
4742
4789
|
'replace-all("Duck duck", regexp("u"), "i")',
|
|
@@ -5183,7 +5230,7 @@ let add = (x, y) -> do
|
|
|
5183
5230
|
y: Second number.
|
|
5184
5231
|
Returns:
|
|
5185
5232
|
Sum of x and y.
|
|
5186
|
-
"""
|
|
5233
|
+
""";
|
|
5187
5234
|
x + y;
|
|
5188
5235
|
end;
|
|
5189
5236
|
|
|
@@ -5246,7 +5293,7 @@ const vectorNormalExpression = {
|
|
|
5246
5293
|
},
|
|
5247
5294
|
variants: [{ argumentNames: ['vector'] }],
|
|
5248
5295
|
description: 'Returns the **sum** of all elements in the `vector`. Returns `0` for an empty vector.',
|
|
5249
|
-
seeAlso: ['prod', 'mean', 'median', 'vector.sum'],
|
|
5296
|
+
seeAlso: ['prod', 'mean', 'median', 'vector.moving-sum', 'vector.centered-moving-sum', 'vector.running-sum', 'vector.cumsum'],
|
|
5250
5297
|
examples: [
|
|
5251
5298
|
'sum([1, 2, 3, 4, 5])',
|
|
5252
5299
|
'sum([1, -2, 3])',
|
|
@@ -5268,7 +5315,7 @@ const vectorNormalExpression = {
|
|
|
5268
5315
|
},
|
|
5269
5316
|
variants: [{ argumentNames: ['vector'] }],
|
|
5270
5317
|
description: 'Returns the **product** of all elements in the `vector`. Returns `1` for an empty vector.',
|
|
5271
|
-
seeAlso: ['sum', 'mean', 'median', 'vector.prod'],
|
|
5318
|
+
seeAlso: ['sum', 'mean', 'median', 'vector.moving-prod', 'vector.centered-moving-prod', 'vector.running-prod', 'vector.cumprod'],
|
|
5272
5319
|
examples: [
|
|
5273
5320
|
'prod([1, 2, 3, 4, 5])',
|
|
5274
5321
|
'prod([1, -2, 3])',
|
|
@@ -5290,7 +5337,7 @@ const vectorNormalExpression = {
|
|
|
5290
5337
|
},
|
|
5291
5338
|
variants: [{ argumentNames: ['vector'] }],
|
|
5292
5339
|
description: 'Returns the arithmetic **mean** of all elements in the `vector`. Throws for an empty vector.',
|
|
5293
|
-
seeAlso: ['median', 'sum', 'prod', 'vector.mean'],
|
|
5340
|
+
seeAlso: ['median', 'sum', 'prod', 'vector.moving-mean', 'vector.centered-moving-mean', 'vector.running-mean', 'vector.geometric-mean', 'vector.harmonic-mean', 'vector.rms', 'vector.mode'],
|
|
5294
5341
|
examples: [
|
|
5295
5342
|
'mean([1, 2, 3, 4, 5])',
|
|
5296
5343
|
'mean([1, -2, 3])',
|
|
@@ -5311,7 +5358,7 @@ const vectorNormalExpression = {
|
|
|
5311
5358
|
},
|
|
5312
5359
|
variants: [{ argumentNames: ['vector'] }],
|
|
5313
5360
|
description: 'Returns the **median** of all elements in the `vector`. For even-length vectors, returns the average of the two middle values. Throws for an empty vector.',
|
|
5314
|
-
seeAlso: ['mean', 'sum', 'prod', 'vector.median'],
|
|
5361
|
+
seeAlso: ['mean', 'sum', 'prod', 'vector.moving-median', 'vector.centered-moving-median', 'vector.running-median', 'vector.mode', 'vector.quartiles', 'vector.percentile', 'vector.iqr', 'vector.medad'],
|
|
5315
5362
|
examples: [
|
|
5316
5363
|
'median([1, 2, 3, 4, 5])',
|
|
5317
5364
|
'median([1, 2, 3, 4])',
|
|
@@ -5328,6 +5375,7 @@ function setNormalExpressionReference(reference) {
|
|
|
5328
5375
|
}
|
|
5329
5376
|
const expressions$1 = {
|
|
5330
5377
|
// Core categories
|
|
5378
|
+
...assertionNormalExpression,
|
|
5331
5379
|
...bitwiseNormalExpression,
|
|
5332
5380
|
...collectionNormalExpression,
|
|
5333
5381
|
...arrayNormalExpression,
|
|
@@ -5455,55 +5503,378 @@ const condSpecialExpression = {
|
|
|
5455
5503
|
getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1].flat(), contextStack, builtin, evaluateNode),
|
|
5456
5504
|
};
|
|
5457
5505
|
|
|
5506
|
+
function isJsFunction(fn) {
|
|
5507
|
+
return typeof fn === 'object' && fn !== null && 'fn' in fn && typeof fn.fn === 'function';
|
|
5508
|
+
}
|
|
5509
|
+
const bindingTargetTypes = {
|
|
5510
|
+
symbol: 11,
|
|
5511
|
+
rest: 12,
|
|
5512
|
+
object: 13,
|
|
5513
|
+
array: 14,
|
|
5514
|
+
literal: 15,
|
|
5515
|
+
wildcard: 16,
|
|
5516
|
+
};
|
|
5517
|
+
|
|
5518
|
+
function walkDefaults(bindingTarget, onDefault) {
|
|
5519
|
+
if (bindingTarget[0] === bindingTargetTypes.object) {
|
|
5520
|
+
Object.values(bindingTarget[1][0]).forEach((element) => {
|
|
5521
|
+
if (element[1][1]) {
|
|
5522
|
+
onDefault(element[1][1]);
|
|
5523
|
+
}
|
|
5524
|
+
walkDefaults(element, onDefault);
|
|
5525
|
+
});
|
|
5526
|
+
}
|
|
5527
|
+
else if (bindingTarget[0] === bindingTargetTypes.array) {
|
|
5528
|
+
for (let index = 0; index < bindingTarget[1][0].length; index += 1) {
|
|
5529
|
+
const element = bindingTarget[1][0][index] ?? null;
|
|
5530
|
+
if (element === null) {
|
|
5531
|
+
continue;
|
|
5532
|
+
}
|
|
5533
|
+
if (element[1][1]) {
|
|
5534
|
+
onDefault(element[1][1]);
|
|
5535
|
+
}
|
|
5536
|
+
walkDefaults(element, onDefault);
|
|
5537
|
+
}
|
|
5538
|
+
}
|
|
5539
|
+
// literal and wildcard have no defaults - nothing to walk
|
|
5540
|
+
}
|
|
5541
|
+
function evaluateBindingNodeValues(target, value, evaluate) {
|
|
5542
|
+
const sourceCodeInfo = target[2];
|
|
5543
|
+
const record = {};
|
|
5544
|
+
return chain(createRecord(target, value, evaluate, sourceCodeInfo, record), () => record);
|
|
5545
|
+
}
|
|
5546
|
+
function createRecord(bindingTarget, value, evaluate, sourceCodeInfo, record) {
|
|
5547
|
+
if (bindingTarget[0] === bindingTargetTypes.object) {
|
|
5548
|
+
assertUnknownRecord(value, sourceCodeInfo);
|
|
5549
|
+
const capturedKeys = new Set();
|
|
5550
|
+
let restElement;
|
|
5551
|
+
const entries = Object.entries(bindingTarget[1][0]);
|
|
5552
|
+
return chain(forEachSequential(entries, ([key, element]) => {
|
|
5553
|
+
if (element[0] === bindingTargetTypes.rest) {
|
|
5554
|
+
restElement = element;
|
|
5555
|
+
return;
|
|
5556
|
+
}
|
|
5557
|
+
capturedKeys.add(key);
|
|
5558
|
+
const existingVal = value[key];
|
|
5559
|
+
const maybeVal = existingVal !== undefined
|
|
5560
|
+
? existingVal
|
|
5561
|
+
: element[1][1]
|
|
5562
|
+
? evaluate(element[1][1])
|
|
5563
|
+
: null;
|
|
5564
|
+
return chain(maybeVal, (resolvedVal) => {
|
|
5565
|
+
const val = resolvedVal ?? null;
|
|
5566
|
+
assertAny(val, sourceCodeInfo);
|
|
5567
|
+
return createRecord(element, val, evaluate, sourceCodeInfo, record);
|
|
5568
|
+
});
|
|
5569
|
+
}), () => {
|
|
5570
|
+
if (restElement) {
|
|
5571
|
+
const restValues = Object.entries(value)
|
|
5572
|
+
.filter(([key]) => !capturedKeys.has(key))
|
|
5573
|
+
.reduce((acc, [key, val]) => {
|
|
5574
|
+
acc[key] = asAny(val);
|
|
5575
|
+
return acc;
|
|
5576
|
+
}, {});
|
|
5577
|
+
record[restElement[1][0]] = restValues;
|
|
5578
|
+
}
|
|
5579
|
+
});
|
|
5580
|
+
}
|
|
5581
|
+
else if (bindingTarget[0] === bindingTargetTypes.array) {
|
|
5582
|
+
let restIndex = null;
|
|
5583
|
+
assertArray(value, sourceCodeInfo);
|
|
5584
|
+
const elements = [];
|
|
5585
|
+
for (let index = 0; index < bindingTarget[1][0].length; index += 1) {
|
|
5586
|
+
const element = bindingTarget[1][0][index] ?? null;
|
|
5587
|
+
if (element === null) {
|
|
5588
|
+
continue;
|
|
5589
|
+
}
|
|
5590
|
+
if (element[0] === bindingTargetTypes.rest) {
|
|
5591
|
+
restIndex = index;
|
|
5592
|
+
break;
|
|
5593
|
+
}
|
|
5594
|
+
elements.push({ element, index });
|
|
5595
|
+
}
|
|
5596
|
+
return chain(forEachSequential(elements, ({ element, index }) => {
|
|
5597
|
+
const existingVal = value[index];
|
|
5598
|
+
const maybeVal = existingVal !== undefined
|
|
5599
|
+
? existingVal
|
|
5600
|
+
: element[1][1]
|
|
5601
|
+
? evaluate(element[1][1])
|
|
5602
|
+
: null;
|
|
5603
|
+
return chain(maybeVal, (resolvedVal) => {
|
|
5604
|
+
const val = resolvedVal ?? null;
|
|
5605
|
+
assertAny(val, sourceCodeInfo);
|
|
5606
|
+
return createRecord(element, val, evaluate, sourceCodeInfo, record);
|
|
5607
|
+
});
|
|
5608
|
+
}), () => {
|
|
5609
|
+
if (restIndex !== null) {
|
|
5610
|
+
const restValues = value.slice(restIndex);
|
|
5611
|
+
const restElement = bindingTarget[1][0][restIndex];
|
|
5612
|
+
record[restElement[1][0]] = restValues;
|
|
5613
|
+
}
|
|
5614
|
+
});
|
|
5615
|
+
}
|
|
5616
|
+
else if (bindingTarget[0] === bindingTargetTypes.rest) {
|
|
5617
|
+
record[bindingTarget[1][0]] = asAny(value);
|
|
5618
|
+
}
|
|
5619
|
+
else {
|
|
5620
|
+
record[bindingTarget[1][0][1]] = asAny(value);
|
|
5621
|
+
}
|
|
5622
|
+
}
|
|
5623
|
+
function getAllBindingTargetNames(bindingTarget) {
|
|
5624
|
+
const names = {};
|
|
5625
|
+
getNamesFromBindingTarget(bindingTarget, names);
|
|
5626
|
+
return names;
|
|
5627
|
+
}
|
|
5628
|
+
function getNamesFromBindingTarget(target, names) {
|
|
5629
|
+
if (target === null) {
|
|
5630
|
+
return;
|
|
5631
|
+
}
|
|
5632
|
+
if (target[0] === bindingTargetTypes.array) {
|
|
5633
|
+
for (const element of target[1][0]) {
|
|
5634
|
+
getNamesFromBindingTarget(element, names);
|
|
5635
|
+
}
|
|
5636
|
+
}
|
|
5637
|
+
else if (target[0] === bindingTargetTypes.object) {
|
|
5638
|
+
for (const element of Object.values(target[1][0])) {
|
|
5639
|
+
getNamesFromBindingTarget(element, names);
|
|
5640
|
+
}
|
|
5641
|
+
}
|
|
5642
|
+
else if (target[0] === bindingTargetTypes.rest) {
|
|
5643
|
+
if (names[target[1][0]]) {
|
|
5644
|
+
throw new LitsError(`Duplicate binding name: ${target[1][0]}`, target[2]);
|
|
5645
|
+
}
|
|
5646
|
+
names[target[1][0]] = true;
|
|
5647
|
+
}
|
|
5648
|
+
else if (target[0] === bindingTargetTypes.symbol) {
|
|
5649
|
+
if (names[target[1][0][1]]) {
|
|
5650
|
+
throw new LitsError(`Duplicate binding name: ${target[1][0]}`, target[2]);
|
|
5651
|
+
}
|
|
5652
|
+
names[target[1][0][1]] = true;
|
|
5653
|
+
}
|
|
5654
|
+
// literal and wildcard bind no names - skip
|
|
5655
|
+
}
|
|
5656
|
+
/**
|
|
5657
|
+
* Non-throwing pattern matching. Returns bindings on match, null on mismatch.
|
|
5658
|
+
* Used by `switch` pattern matching.
|
|
5659
|
+
*/
|
|
5660
|
+
function tryMatch(target, value, evaluate) {
|
|
5661
|
+
const record = {};
|
|
5662
|
+
return chain(tryMatchRecord(target, value, evaluate, record), (matched) => {
|
|
5663
|
+
if (!matched)
|
|
5664
|
+
return null;
|
|
5665
|
+
return record;
|
|
5666
|
+
});
|
|
5667
|
+
}
|
|
5668
|
+
function tryMatchRecord(bindingTarget, value, evaluate, record) {
|
|
5669
|
+
// Wildcard: always matches, binds nothing
|
|
5670
|
+
if (bindingTarget[0] === bindingTargetTypes.wildcard) {
|
|
5671
|
+
return true;
|
|
5672
|
+
}
|
|
5673
|
+
// Literal: compare with deepEqual
|
|
5674
|
+
else if (bindingTarget[0] === bindingTargetTypes.literal) {
|
|
5675
|
+
const literalNode = bindingTarget[1][0];
|
|
5676
|
+
return chain(evaluate(literalNode), (literalValue) => {
|
|
5677
|
+
return deepEqual(value, literalValue);
|
|
5678
|
+
});
|
|
5679
|
+
}
|
|
5680
|
+
// Symbol: always matches, binds value
|
|
5681
|
+
else if (bindingTarget[0] === bindingTargetTypes.symbol) {
|
|
5682
|
+
const symbolNode = bindingTarget[1][0];
|
|
5683
|
+
const defaultNode = bindingTarget[1][1];
|
|
5684
|
+
if (value === undefined || value === null) {
|
|
5685
|
+
if (defaultNode) {
|
|
5686
|
+
return chain(evaluate(defaultNode), (defaultValue) => {
|
|
5687
|
+
record[symbolNode[1]] = asAny(defaultValue);
|
|
5688
|
+
return true;
|
|
5689
|
+
});
|
|
5690
|
+
}
|
|
5691
|
+
record[symbolNode[1]] = value ?? null;
|
|
5692
|
+
}
|
|
5693
|
+
else {
|
|
5694
|
+
record[symbolNode[1]] = asAny(value);
|
|
5695
|
+
}
|
|
5696
|
+
return true;
|
|
5697
|
+
}
|
|
5698
|
+
// Object pattern
|
|
5699
|
+
else if (bindingTarget[0] === bindingTargetTypes.object) {
|
|
5700
|
+
if (!isUnknownRecord(value))
|
|
5701
|
+
return false;
|
|
5702
|
+
const capturedKeys = new Set();
|
|
5703
|
+
let restElement;
|
|
5704
|
+
const entries = Object.entries(bindingTarget[1][0]);
|
|
5705
|
+
let result = true;
|
|
5706
|
+
for (const [key, element] of entries) {
|
|
5707
|
+
result = chain(result, (matched) => {
|
|
5708
|
+
if (!matched)
|
|
5709
|
+
return false;
|
|
5710
|
+
if (element[0] === bindingTargetTypes.rest) {
|
|
5711
|
+
restElement = element;
|
|
5712
|
+
return true;
|
|
5713
|
+
}
|
|
5714
|
+
capturedKeys.add(key);
|
|
5715
|
+
const existingVal = value[key];
|
|
5716
|
+
// For literal sub-patterns, missing key means no match
|
|
5717
|
+
if (existingVal === undefined && element[0] === bindingTargetTypes.literal) {
|
|
5718
|
+
return chain(evaluate(element[1][0]), (literalValue) => {
|
|
5719
|
+
return deepEqual(undefined, literalValue);
|
|
5720
|
+
});
|
|
5721
|
+
}
|
|
5722
|
+
const maybeVal = existingVal !== undefined
|
|
5723
|
+
? existingVal
|
|
5724
|
+
: element[1] && element[1][1]
|
|
5725
|
+
? evaluate(element[1][1])
|
|
5726
|
+
: null;
|
|
5727
|
+
return chain(maybeVal, (resolvedVal) => {
|
|
5728
|
+
const val = resolvedVal ?? null;
|
|
5729
|
+
return tryMatchRecord(element, val, evaluate, record);
|
|
5730
|
+
});
|
|
5731
|
+
});
|
|
5732
|
+
}
|
|
5733
|
+
return chain(result, (matched) => {
|
|
5734
|
+
if (!matched)
|
|
5735
|
+
return false;
|
|
5736
|
+
if (restElement) {
|
|
5737
|
+
const restValues = Object.entries(value)
|
|
5738
|
+
.filter(([key]) => !capturedKeys.has(key))
|
|
5739
|
+
.reduce((acc, [key, val]) => {
|
|
5740
|
+
acc[key] = asAny(val);
|
|
5741
|
+
return acc;
|
|
5742
|
+
}, {});
|
|
5743
|
+
record[restElement[1][0]] = restValues;
|
|
5744
|
+
}
|
|
5745
|
+
return true;
|
|
5746
|
+
});
|
|
5747
|
+
}
|
|
5748
|
+
// Array pattern
|
|
5749
|
+
else {
|
|
5750
|
+
const arrayTarget = bindingTarget;
|
|
5751
|
+
if (!Array.isArray(value))
|
|
5752
|
+
return false;
|
|
5753
|
+
const elements = arrayTarget[1][0];
|
|
5754
|
+
let restIndex = null;
|
|
5755
|
+
// Find rest element index and check length constraints
|
|
5756
|
+
for (let i = 0; i < elements.length; i += 1) {
|
|
5757
|
+
const element = elements[i];
|
|
5758
|
+
if (element !== null && element[0] === bindingTargetTypes.rest) {
|
|
5759
|
+
restIndex = i;
|
|
5760
|
+
break;
|
|
5761
|
+
}
|
|
5762
|
+
}
|
|
5763
|
+
// Without rest: array length must match exactly
|
|
5764
|
+
if (restIndex === null && value.length !== elements.length) {
|
|
5765
|
+
return false;
|
|
5766
|
+
}
|
|
5767
|
+
// With rest: array must have at least the non-rest elements
|
|
5768
|
+
if (restIndex !== null && value.length < restIndex) {
|
|
5769
|
+
return false;
|
|
5770
|
+
}
|
|
5771
|
+
let result = true;
|
|
5772
|
+
for (let i = 0; i < elements.length; i += 1) {
|
|
5773
|
+
const element = elements[i];
|
|
5774
|
+
if (element === null)
|
|
5775
|
+
continue; // skipped position
|
|
5776
|
+
if (element[0] === bindingTargetTypes.rest) {
|
|
5777
|
+
// Rest collects remaining elements
|
|
5778
|
+
record[element[1][0]] = value.slice(i);
|
|
5779
|
+
break;
|
|
5780
|
+
}
|
|
5781
|
+
const el = element;
|
|
5782
|
+
result = chain(result, (matched) => {
|
|
5783
|
+
if (!matched)
|
|
5784
|
+
return false;
|
|
5785
|
+
return tryMatchRecord(el, asAny(value[i]), evaluate, record);
|
|
5786
|
+
});
|
|
5787
|
+
}
|
|
5788
|
+
return result;
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
|
|
5458
5792
|
const docs$e = {
|
|
5459
5793
|
category: 'special-expression',
|
|
5460
|
-
customVariants: ['
|
|
5794
|
+
customVariants: ['match value match-branch match-branch ... end'],
|
|
5461
5795
|
details: [
|
|
5462
|
-
['value', 'any', 'The value to
|
|
5463
|
-
['
|
|
5464
|
-
['
|
|
5465
|
-
['
|
|
5796
|
+
['value', 'any', 'The value to match against patterns.'],
|
|
5797
|
+
['match-branch', 'case pattern [when guard] then body', 'A branch of the match expression.'],
|
|
5798
|
+
['pattern', 'pattern', 'A pattern to match: literal, variable, array destructuring, object destructuring, or wildcard (_).'],
|
|
5799
|
+
['guard', 'expression', 'An optional guard expression that must be truthy for the match to succeed.'],
|
|
5800
|
+
['body', 'expressions', 'The expressions to evaluate if the pattern matches.'],
|
|
5466
5801
|
],
|
|
5467
|
-
description: '
|
|
5802
|
+
description: 'Pattern matching expression. Matches `value` against each `pattern` sequentially. If a pattern matches (and the optional `when` guard is truthy), the corresponding `body` is evaluated and its result returned. Bound variables from the pattern are available in the guard and body. If no pattern matches, `null` is returned.',
|
|
5468
5803
|
examples: [
|
|
5469
5804
|
`
|
|
5470
|
-
|
|
5471
|
-
case 1 then
|
|
5472
|
-
case 2 then
|
|
5805
|
+
match 1
|
|
5806
|
+
case 1 then "One"
|
|
5807
|
+
case 2 then "Two"
|
|
5473
5808
|
end`,
|
|
5474
5809
|
`
|
|
5475
|
-
|
|
5476
|
-
case
|
|
5477
|
-
case
|
|
5810
|
+
match [1, 2, 3]
|
|
5811
|
+
case [x] then "one element"
|
|
5812
|
+
case [x, y] then "two elements"
|
|
5813
|
+
case [x, ...xs] then "first: " ++ str(x) ++ " rest: " ++ str(xs)
|
|
5478
5814
|
end`,
|
|
5479
5815
|
`
|
|
5480
|
-
|
|
5481
|
-
case
|
|
5482
|
-
case
|
|
5816
|
+
match { type: "click", x: 10, y: 20 }
|
|
5817
|
+
case { type: "click", x, y } then "Click at " ++ str(x) ++ ", " ++ str(y)
|
|
5818
|
+
case { type: "keydown", key } then "Key: " ++ key
|
|
5819
|
+
case _ then "unknown event"
|
|
5820
|
+
end`,
|
|
5821
|
+
`
|
|
5822
|
+
match { role: "admin", name: "Alice" }
|
|
5823
|
+
case { role: "admin", name } then "Admin: " ++ name
|
|
5824
|
+
case { role, name } when role == "user" then "User: " ++ name
|
|
5825
|
+
case _ then "Unknown role"
|
|
5483
5826
|
end`,
|
|
5484
5827
|
],
|
|
5485
5828
|
};
|
|
5486
|
-
const
|
|
5829
|
+
const matchSpecialExpression = {
|
|
5487
5830
|
arity: {},
|
|
5488
5831
|
docs: docs$e,
|
|
5489
5832
|
evaluate: (node, contextStack, { evaluateNode }) => {
|
|
5490
|
-
const [,
|
|
5491
|
-
return chain(evaluateNode(
|
|
5833
|
+
const [, matchValueNode, cases] = node[1];
|
|
5834
|
+
return chain(evaluateNode(matchValueNode, contextStack), (matchValue) => {
|
|
5492
5835
|
function processCase(index) {
|
|
5493
5836
|
if (index >= cases.length)
|
|
5494
5837
|
return null;
|
|
5495
|
-
const [
|
|
5496
|
-
return chain(evaluateNode(
|
|
5497
|
-
if (
|
|
5498
|
-
return
|
|
5838
|
+
const [pattern, body, guard] = cases[index];
|
|
5839
|
+
return chain(tryMatch(pattern, matchValue, n => evaluateNode(n, contextStack)), (bindings) => {
|
|
5840
|
+
if (bindings === null)
|
|
5841
|
+
return processCase(index + 1);
|
|
5842
|
+
// Pattern matched - create context with bound variables
|
|
5843
|
+
const context = {};
|
|
5844
|
+
for (const [name, value] of Object.entries(bindings)) {
|
|
5845
|
+
context[name] = { value };
|
|
5499
5846
|
}
|
|
5500
|
-
|
|
5847
|
+
const newContextStack = contextStack.create(context);
|
|
5848
|
+
// Check guard if present
|
|
5849
|
+
if (guard) {
|
|
5850
|
+
return chain(evaluateNode(guard, newContextStack), (guardResult) => {
|
|
5851
|
+
if (!guardResult)
|
|
5852
|
+
return processCase(index + 1);
|
|
5853
|
+
return evaluateNode(body, newContextStack);
|
|
5854
|
+
});
|
|
5855
|
+
}
|
|
5856
|
+
return evaluateNode(body, newContextStack);
|
|
5501
5857
|
});
|
|
5502
5858
|
}
|
|
5503
5859
|
return processCase(0);
|
|
5504
5860
|
});
|
|
5505
5861
|
},
|
|
5506
|
-
getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) =>
|
|
5862
|
+
getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {
|
|
5863
|
+
const result = new Set();
|
|
5864
|
+
// The match value expression
|
|
5865
|
+
getUndefinedSymbols([node[1][1]], contextStack, builtin, evaluateNode).forEach(s => result.add(s));
|
|
5866
|
+
// Each case
|
|
5867
|
+
for (const [pattern, body, guard] of node[1][2]) {
|
|
5868
|
+
const newContext = {};
|
|
5869
|
+
Object.assign(newContext, getAllBindingTargetNames(pattern));
|
|
5870
|
+
const caseContextStack = contextStack.create(newContext);
|
|
5871
|
+
if (guard) {
|
|
5872
|
+
getUndefinedSymbols([guard], caseContextStack, builtin, evaluateNode).forEach(s => result.add(s));
|
|
5873
|
+
}
|
|
5874
|
+
getUndefinedSymbols([body], caseContextStack, builtin, evaluateNode).forEach(s => result.add(s));
|
|
5875
|
+
}
|
|
5876
|
+
return result;
|
|
5877
|
+
},
|
|
5507
5878
|
};
|
|
5508
5879
|
|
|
5509
5880
|
const docs$d = {
|
|
@@ -5570,153 +5941,6 @@ const doSpecialExpression = {
|
|
|
5570
5941
|
},
|
|
5571
5942
|
};
|
|
5572
5943
|
|
|
5573
|
-
function isJsFunction(fn) {
|
|
5574
|
-
return typeof fn === 'object' && fn !== null && 'fn' in fn && typeof fn.fn === 'function';
|
|
5575
|
-
}
|
|
5576
|
-
const bindingTargetTypes = {
|
|
5577
|
-
symbol: 11,
|
|
5578
|
-
rest: 12,
|
|
5579
|
-
object: 13,
|
|
5580
|
-
array: 14,
|
|
5581
|
-
};
|
|
5582
|
-
|
|
5583
|
-
function walkDefaults(bindingTarget, onDefault) {
|
|
5584
|
-
if (bindingTarget[0] === bindingTargetTypes.object) {
|
|
5585
|
-
Object.values(bindingTarget[1][0]).forEach((element) => {
|
|
5586
|
-
if (element[1][1]) {
|
|
5587
|
-
onDefault(element[1][1]);
|
|
5588
|
-
}
|
|
5589
|
-
walkDefaults(element, onDefault);
|
|
5590
|
-
});
|
|
5591
|
-
}
|
|
5592
|
-
else if (bindingTarget[0] === bindingTargetTypes.array) {
|
|
5593
|
-
for (let index = 0; index < bindingTarget[1][0].length; index += 1) {
|
|
5594
|
-
const element = bindingTarget[1][0][index] ?? null;
|
|
5595
|
-
if (element === null) {
|
|
5596
|
-
continue;
|
|
5597
|
-
}
|
|
5598
|
-
if (element[1][1]) {
|
|
5599
|
-
onDefault(element[1][1]);
|
|
5600
|
-
}
|
|
5601
|
-
walkDefaults(element, onDefault);
|
|
5602
|
-
}
|
|
5603
|
-
}
|
|
5604
|
-
}
|
|
5605
|
-
function evaluateBindingNodeValues(target, value, evaluate) {
|
|
5606
|
-
const sourceCodeInfo = target[2];
|
|
5607
|
-
const record = {};
|
|
5608
|
-
return chain(createRecord(target, value, evaluate, sourceCodeInfo, record), () => record);
|
|
5609
|
-
}
|
|
5610
|
-
function createRecord(bindingTarget, value, evaluate, sourceCodeInfo, record) {
|
|
5611
|
-
if (bindingTarget[0] === bindingTargetTypes.object) {
|
|
5612
|
-
assertUnknownRecord(value, sourceCodeInfo);
|
|
5613
|
-
const capturedKeys = new Set();
|
|
5614
|
-
let restElement;
|
|
5615
|
-
const entries = Object.entries(bindingTarget[1][0]);
|
|
5616
|
-
return chain(forEachSequential(entries, ([key, element]) => {
|
|
5617
|
-
if (element[0] === bindingTargetTypes.rest) {
|
|
5618
|
-
restElement = element;
|
|
5619
|
-
return;
|
|
5620
|
-
}
|
|
5621
|
-
capturedKeys.add(key);
|
|
5622
|
-
const existingVal = value[key];
|
|
5623
|
-
const maybeVal = existingVal !== undefined
|
|
5624
|
-
? existingVal
|
|
5625
|
-
: element[1][1]
|
|
5626
|
-
? evaluate(element[1][1])
|
|
5627
|
-
: null;
|
|
5628
|
-
return chain(maybeVal, (resolvedVal) => {
|
|
5629
|
-
const val = resolvedVal ?? null;
|
|
5630
|
-
assertAny(val, sourceCodeInfo);
|
|
5631
|
-
return createRecord(element, val, evaluate, sourceCodeInfo, record);
|
|
5632
|
-
});
|
|
5633
|
-
}), () => {
|
|
5634
|
-
if (restElement) {
|
|
5635
|
-
const restValues = Object.entries(value)
|
|
5636
|
-
.filter(([key]) => !capturedKeys.has(key))
|
|
5637
|
-
.reduce((acc, [key, val]) => {
|
|
5638
|
-
acc[key] = asAny(val);
|
|
5639
|
-
return acc;
|
|
5640
|
-
}, {});
|
|
5641
|
-
record[restElement[1][0]] = restValues;
|
|
5642
|
-
}
|
|
5643
|
-
});
|
|
5644
|
-
}
|
|
5645
|
-
else if (bindingTarget[0] === bindingTargetTypes.array) {
|
|
5646
|
-
let restIndex = null;
|
|
5647
|
-
assertArray(value, sourceCodeInfo);
|
|
5648
|
-
const elements = [];
|
|
5649
|
-
for (let index = 0; index < bindingTarget[1][0].length; index += 1) {
|
|
5650
|
-
const element = bindingTarget[1][0][index] ?? null;
|
|
5651
|
-
if (element === null) {
|
|
5652
|
-
continue;
|
|
5653
|
-
}
|
|
5654
|
-
if (element[0] === bindingTargetTypes.rest) {
|
|
5655
|
-
restIndex = index;
|
|
5656
|
-
break;
|
|
5657
|
-
}
|
|
5658
|
-
elements.push({ element, index });
|
|
5659
|
-
}
|
|
5660
|
-
return chain(forEachSequential(elements, ({ element, index }) => {
|
|
5661
|
-
const existingVal = value[index];
|
|
5662
|
-
const maybeVal = existingVal !== undefined
|
|
5663
|
-
? existingVal
|
|
5664
|
-
: element[1][1]
|
|
5665
|
-
? evaluate(element[1][1])
|
|
5666
|
-
: null;
|
|
5667
|
-
return chain(maybeVal, (resolvedVal) => {
|
|
5668
|
-
const val = resolvedVal ?? null;
|
|
5669
|
-
assertAny(val, sourceCodeInfo);
|
|
5670
|
-
return createRecord(element, val, evaluate, sourceCodeInfo, record);
|
|
5671
|
-
});
|
|
5672
|
-
}), () => {
|
|
5673
|
-
if (restIndex !== null) {
|
|
5674
|
-
const restValues = value.slice(restIndex);
|
|
5675
|
-
const restElement = bindingTarget[1][0][restIndex];
|
|
5676
|
-
record[restElement[1][0]] = restValues;
|
|
5677
|
-
}
|
|
5678
|
-
});
|
|
5679
|
-
}
|
|
5680
|
-
else if (bindingTarget[0] === bindingTargetTypes.rest) {
|
|
5681
|
-
record[bindingTarget[1][0]] = asAny(value);
|
|
5682
|
-
}
|
|
5683
|
-
else {
|
|
5684
|
-
record[bindingTarget[1][0][1]] = asAny(value);
|
|
5685
|
-
}
|
|
5686
|
-
}
|
|
5687
|
-
function getAllBindingTargetNames(bindingTarget) {
|
|
5688
|
-
const names = {};
|
|
5689
|
-
getNamesFromBindingTarget(bindingTarget, names);
|
|
5690
|
-
return names;
|
|
5691
|
-
}
|
|
5692
|
-
function getNamesFromBindingTarget(target, names) {
|
|
5693
|
-
if (target === null) {
|
|
5694
|
-
return;
|
|
5695
|
-
}
|
|
5696
|
-
if (target[0] === bindingTargetTypes.array) {
|
|
5697
|
-
for (const element of target[1][0]) {
|
|
5698
|
-
getNamesFromBindingTarget(element, names);
|
|
5699
|
-
}
|
|
5700
|
-
}
|
|
5701
|
-
else if (target[0] === bindingTargetTypes.object) {
|
|
5702
|
-
for (const element of Object.values(target[1][0])) {
|
|
5703
|
-
getNamesFromBindingTarget(element, names);
|
|
5704
|
-
}
|
|
5705
|
-
}
|
|
5706
|
-
else if (target[0] === bindingTargetTypes.rest) {
|
|
5707
|
-
if (names[target[1][0]]) {
|
|
5708
|
-
throw new LitsError(`Duplicate binding name: ${target[1][0]}`, target[2]);
|
|
5709
|
-
}
|
|
5710
|
-
names[target[1][0]] = true;
|
|
5711
|
-
}
|
|
5712
|
-
else {
|
|
5713
|
-
if (names[target[1][0][1]]) {
|
|
5714
|
-
throw new LitsError(`Duplicate binding name: ${target[1][0]}`, target[2]);
|
|
5715
|
-
}
|
|
5716
|
-
names[target[1][0][1]] = true;
|
|
5717
|
-
}
|
|
5718
|
-
}
|
|
5719
|
-
|
|
5720
5944
|
const lambdaSpecialExpression = {
|
|
5721
5945
|
arity: {},
|
|
5722
5946
|
evaluate: (node, contextStack, { builtin, getUndefinedSymbols, evaluateNode }) => {
|
|
@@ -6639,8 +6863,8 @@ const docs = {
|
|
|
6639
6863
|
],
|
|
6640
6864
|
returns: { type: 'object' },
|
|
6641
6865
|
examples: [
|
|
6642
|
-
'let v = import(vector); v.
|
|
6643
|
-
'let {
|
|
6866
|
+
'let v = import(vector); v.stdev([1, 2, 3, 4])',
|
|
6867
|
+
'let { linspace } = import(vector); linspace(0, 10, 5)',
|
|
6644
6868
|
'let g = import(grid); g.row([[1, 2], [3, 4]], 0)',
|
|
6645
6869
|
],
|
|
6646
6870
|
};
|
|
@@ -6693,7 +6917,7 @@ const specialExpressions = [
|
|
|
6693
6917
|
loopSpecialExpression,
|
|
6694
6918
|
objectSpecialExpression,
|
|
6695
6919
|
recurSpecialExpression,
|
|
6696
|
-
|
|
6920
|
+
matchSpecialExpression,
|
|
6697
6921
|
throwSpecialExpression,
|
|
6698
6922
|
trySpecialExpression,
|
|
6699
6923
|
unlessSpecialExpression,
|
|
@@ -7924,6 +8148,12 @@ function assertOperatorToken(token, operatorName) {
|
|
|
7924
8148
|
function isWhitespaceToken(token) {
|
|
7925
8149
|
return token?.[0] === 'Whitespace';
|
|
7926
8150
|
}
|
|
8151
|
+
function isNumberToken(token) {
|
|
8152
|
+
return token?.[0] === 'Number';
|
|
8153
|
+
}
|
|
8154
|
+
function isBasePrefixedNumberToken(token) {
|
|
8155
|
+
return token?.[0] === 'BasePrefixedNumber';
|
|
8156
|
+
}
|
|
7927
8157
|
function isLParenToken(token) {
|
|
7928
8158
|
return token?.[0] === 'LParen';
|
|
7929
8159
|
}
|
|
@@ -8448,6 +8678,10 @@ function parseDo(ctx, allowDocString = false) {
|
|
|
8448
8678
|
let docString = '';
|
|
8449
8679
|
if (allowDocString && isDocStringToken(ctx.tryPeek())) {
|
|
8450
8680
|
docString = parseDocString(ctx);
|
|
8681
|
+
if (!ctx.isAtEnd() && !isReservedSymbolToken(ctx.tryPeek(), 'end')) {
|
|
8682
|
+
assertOperatorToken(ctx.tryPeek(), ';');
|
|
8683
|
+
ctx.advance();
|
|
8684
|
+
}
|
|
8451
8685
|
}
|
|
8452
8686
|
const expressions = [];
|
|
8453
8687
|
while (!ctx.isAtEnd() && !isReservedSymbolToken(ctx.tryPeek(), 'end')) {
|
|
@@ -8487,8 +8721,48 @@ function parseSymbol(ctx) {
|
|
|
8487
8721
|
}
|
|
8488
8722
|
}
|
|
8489
8723
|
|
|
8490
|
-
function
|
|
8724
|
+
function parseNumber(ctx) {
|
|
8725
|
+
const token = ctx.peek();
|
|
8726
|
+
ctx.advance();
|
|
8727
|
+
const value = token[1];
|
|
8728
|
+
const negative = value[0] === '-';
|
|
8729
|
+
const numberString = (negative ? value.substring(1) : value).replace(/_/g, '');
|
|
8730
|
+
return withSourceCodeInfo([NodeTypes.Number, negative ? -Number(numberString) : Number(numberString)], token[2]);
|
|
8731
|
+
}
|
|
8732
|
+
|
|
8733
|
+
function parseBindingTarget(ctx, { requireDefaultValue, noRest, allowLiteralPatterns } = {}) {
|
|
8491
8734
|
const firstToken = ctx.tryPeek();
|
|
8735
|
+
// Wildcard _ (only in pattern matching context)
|
|
8736
|
+
if (allowLiteralPatterns && isReservedSymbolToken(firstToken, '_')) {
|
|
8737
|
+
ctx.advance();
|
|
8738
|
+
return withSourceCodeInfo([bindingTargetTypes.wildcard, []], firstToken[2]);
|
|
8739
|
+
}
|
|
8740
|
+
// Literal patterns: number, string, true, false, null (only in pattern matching context)
|
|
8741
|
+
if (allowLiteralPatterns && isLiteralToken(firstToken)) {
|
|
8742
|
+
if (isNumberToken(firstToken) || isBasePrefixedNumberToken(firstToken)) {
|
|
8743
|
+
const node = parseNumber(ctx);
|
|
8744
|
+
return withSourceCodeInfo([bindingTargetTypes.literal, [node]], firstToken[2]);
|
|
8745
|
+
}
|
|
8746
|
+
if (isStringToken(firstToken)) {
|
|
8747
|
+
const node = parseString(ctx, firstToken);
|
|
8748
|
+
return withSourceCodeInfo([bindingTargetTypes.literal, [node]], firstToken[2]);
|
|
8749
|
+
}
|
|
8750
|
+
if (isReservedSymbolToken(firstToken, 'true')) {
|
|
8751
|
+
ctx.advance();
|
|
8752
|
+
const node = withSourceCodeInfo([NodeTypes.ReservedSymbol, 'true'], firstToken[2]);
|
|
8753
|
+
return withSourceCodeInfo([bindingTargetTypes.literal, [node]], firstToken[2]);
|
|
8754
|
+
}
|
|
8755
|
+
if (isReservedSymbolToken(firstToken, 'false')) {
|
|
8756
|
+
ctx.advance();
|
|
8757
|
+
const node = withSourceCodeInfo([NodeTypes.ReservedSymbol, 'false'], firstToken[2]);
|
|
8758
|
+
return withSourceCodeInfo([bindingTargetTypes.literal, [node]], firstToken[2]);
|
|
8759
|
+
}
|
|
8760
|
+
if (isReservedSymbolToken(firstToken, 'null')) {
|
|
8761
|
+
ctx.advance();
|
|
8762
|
+
const node = withSourceCodeInfo([NodeTypes.ReservedSymbol, 'null'], firstToken[2]);
|
|
8763
|
+
return withSourceCodeInfo([bindingTargetTypes.literal, [node]], firstToken[2]);
|
|
8764
|
+
}
|
|
8765
|
+
}
|
|
8492
8766
|
// Symbol
|
|
8493
8767
|
if (isSymbolToken(firstToken)) {
|
|
8494
8768
|
const symbol = parseSymbol(ctx);
|
|
@@ -8529,7 +8803,7 @@ function parseBindingTarget(ctx, { requireDefaultValue, noRest } = {}) {
|
|
|
8529
8803
|
token = ctx.peek();
|
|
8530
8804
|
continue;
|
|
8531
8805
|
}
|
|
8532
|
-
const target = parseBindingTarget(ctx);
|
|
8806
|
+
const target = parseBindingTarget(ctx, { allowLiteralPatterns });
|
|
8533
8807
|
if (target[0] === bindingTargetTypes.rest) {
|
|
8534
8808
|
rest = true;
|
|
8535
8809
|
}
|
|
@@ -8593,10 +8867,18 @@ function parseBindingTarget(ctx, { requireDefaultValue, noRest } = {}) {
|
|
|
8593
8867
|
else if (isOperatorToken(token, ':')) {
|
|
8594
8868
|
ctx.advance();
|
|
8595
8869
|
token = ctx.peek();
|
|
8596
|
-
if (
|
|
8597
|
-
|
|
8870
|
+
if (allowLiteralPatterns) {
|
|
8871
|
+
// In pattern matching context, allow literals, nested objects/arrays, and variable bindings after ':'
|
|
8872
|
+
if (!isLBraceToken(token) && !isLBracketToken(token) && !isLiteralToken(token)) {
|
|
8873
|
+
throw new LitsError('Expected literal, object or array pattern', token[2]);
|
|
8874
|
+
}
|
|
8598
8875
|
}
|
|
8599
|
-
|
|
8876
|
+
else {
|
|
8877
|
+
if (!isLBraceToken(token) && !isLBracketToken(token)) {
|
|
8878
|
+
throw new LitsError('Expected object or array', token[2]);
|
|
8879
|
+
}
|
|
8880
|
+
}
|
|
8881
|
+
elements[keyName] = parseBindingTarget(ctx, { allowLiteralPatterns });
|
|
8600
8882
|
}
|
|
8601
8883
|
if (!isRBraceToken(ctx.peek())) {
|
|
8602
8884
|
assertOperatorToken(ctx.peek(), ',');
|
|
@@ -8621,6 +8903,14 @@ function parseOptionalDefaulValue(ctx) {
|
|
|
8621
8903
|
}
|
|
8622
8904
|
return undefined;
|
|
8623
8905
|
}
|
|
8906
|
+
function isLiteralToken(token) {
|
|
8907
|
+
return isNumberToken(token)
|
|
8908
|
+
|| isBasePrefixedNumberToken(token)
|
|
8909
|
+
|| isStringToken(token)
|
|
8910
|
+
|| isReservedSymbolToken(token, 'true')
|
|
8911
|
+
|| isReservedSymbolToken(token, 'false')
|
|
8912
|
+
|| isReservedSymbolToken(token, 'null');
|
|
8913
|
+
}
|
|
8624
8914
|
|
|
8625
8915
|
function parseLet(ctx, token) {
|
|
8626
8916
|
ctx.advance();
|
|
@@ -9046,15 +9336,6 @@ function parseFunctionCall(ctx, symbol) {
|
|
|
9046
9336
|
}
|
|
9047
9337
|
}
|
|
9048
9338
|
|
|
9049
|
-
function parseNumber(ctx) {
|
|
9050
|
-
const token = ctx.peek();
|
|
9051
|
-
ctx.advance();
|
|
9052
|
-
const value = token[1];
|
|
9053
|
-
const negative = value[0] === '-';
|
|
9054
|
-
const numberString = (negative ? value.substring(1) : value).replace(/_/g, '');
|
|
9055
|
-
return withSourceCodeInfo([NodeTypes.Number, negative ? -Number(numberString) : Number(numberString)], token[2]);
|
|
9056
|
-
}
|
|
9057
|
-
|
|
9058
9339
|
function parseObject(ctx) {
|
|
9059
9340
|
const firstToken = asLBraceToken(ctx.tryPeek());
|
|
9060
9341
|
ctx.advance();
|
|
@@ -9205,25 +9486,32 @@ function createAccessorNode(left, right, sourceCodeInfo) {
|
|
|
9205
9486
|
return withSourceCodeInfo([NodeTypes.NormalExpression, [[NodeTypes.NormalBuiltinSymbol, normalExpressionTypes.get], [left, right]]], sourceCodeInfo);
|
|
9206
9487
|
}
|
|
9207
9488
|
|
|
9208
|
-
function
|
|
9489
|
+
function parseMatch(ctx, token) {
|
|
9209
9490
|
ctx.advance();
|
|
9210
9491
|
const valueExpression = ctx.parseExpression();
|
|
9211
9492
|
const params = [];
|
|
9212
9493
|
while (!ctx.isAtEnd() && !isReservedSymbolToken(ctx.tryPeek(), 'end')) {
|
|
9213
9494
|
assertReservedSymbolToken(ctx.tryPeek(), 'case');
|
|
9214
9495
|
ctx.advance();
|
|
9215
|
-
|
|
9496
|
+
// Parse pattern instead of expression
|
|
9497
|
+
const pattern = parseBindingTarget(ctx, { allowLiteralPatterns: true });
|
|
9498
|
+
// Check for optional guard: `when <expression>`
|
|
9499
|
+
let guard;
|
|
9500
|
+
if (isReservedSymbolToken(ctx.tryPeek(), 'when')) {
|
|
9501
|
+
ctx.advance();
|
|
9502
|
+
guard = ctx.parseExpression();
|
|
9503
|
+
}
|
|
9216
9504
|
assertReservedSymbolToken(ctx.tryPeek(), 'then');
|
|
9217
9505
|
ctx.advance();
|
|
9218
9506
|
const thenExpression = parseImplicitBlock(ctx, ['case', 'end']);
|
|
9219
|
-
params.push([
|
|
9507
|
+
params.push([pattern, thenExpression, guard]);
|
|
9220
9508
|
if (isReservedSymbolToken(ctx.tryPeek(), 'end')) {
|
|
9221
9509
|
break;
|
|
9222
9510
|
}
|
|
9223
9511
|
}
|
|
9224
9512
|
assertReservedSymbolToken(ctx.tryPeek(), 'end');
|
|
9225
9513
|
ctx.advance();
|
|
9226
|
-
return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.
|
|
9514
|
+
return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.match, valueExpression, params]], token[2]);
|
|
9227
9515
|
}
|
|
9228
9516
|
|
|
9229
9517
|
function parseTry(ctx, token) {
|
|
@@ -9261,8 +9549,8 @@ function parseExpression(ctx, precedence = 0) {
|
|
|
9261
9549
|
case 'cond':
|
|
9262
9550
|
left = parseCond(ctx, token);
|
|
9263
9551
|
break;
|
|
9264
|
-
case '
|
|
9265
|
-
left =
|
|
9552
|
+
case 'match':
|
|
9553
|
+
left = parseMatch(ctx, token);
|
|
9266
9554
|
break;
|
|
9267
9555
|
case 'for':
|
|
9268
9556
|
case 'doseq':
|
|
@@ -9551,41 +9839,8 @@ class Lits {
|
|
|
9551
9839
|
}
|
|
9552
9840
|
|
|
9553
9841
|
const moduleDocs$6 = {
|
|
9554
|
-
'assert': {
|
|
9555
|
-
category: 'assert',
|
|
9556
|
-
description: 'If $value is falsy it throws `AssertionError` with $message. If no $message is provided, message is set to $value.',
|
|
9557
|
-
returns: {
|
|
9558
|
-
type: 'any',
|
|
9559
|
-
},
|
|
9560
|
-
args: {
|
|
9561
|
-
value: {
|
|
9562
|
-
type: 'any',
|
|
9563
|
-
},
|
|
9564
|
-
message: {
|
|
9565
|
-
type: 'string',
|
|
9566
|
-
},
|
|
9567
|
-
},
|
|
9568
|
-
variants: [
|
|
9569
|
-
{
|
|
9570
|
-
argumentNames: [
|
|
9571
|
-
'value',
|
|
9572
|
-
],
|
|
9573
|
-
},
|
|
9574
|
-
{
|
|
9575
|
-
argumentNames: [
|
|
9576
|
-
'value',
|
|
9577
|
-
'message',
|
|
9578
|
-
],
|
|
9579
|
-
},
|
|
9580
|
-
],
|
|
9581
|
-
examples: [
|
|
9582
|
-
'let { assert } = import(assert);\ntry assert(0, "Expected a positive value") catch (e) e.message end',
|
|
9583
|
-
],
|
|
9584
|
-
seeAlso: ['assert.assert-truthy', 'assert.assert-true'],
|
|
9585
|
-
hideOperatorForm: true,
|
|
9586
|
-
},
|
|
9587
9842
|
'assert!=': {
|
|
9588
|
-
category: '
|
|
9843
|
+
category: 'assertion',
|
|
9589
9844
|
description: 'If $a is the same as $b it throws `AssertionError`.',
|
|
9590
9845
|
returns: {
|
|
9591
9846
|
type: 'null',
|
|
@@ -9617,16 +9872,16 @@ const moduleDocs$6 = {
|
|
|
9617
9872
|
},
|
|
9618
9873
|
],
|
|
9619
9874
|
examples: [
|
|
9620
|
-
'let { assert!= } = import(
|
|
9621
|
-
'let { assert!= } = import(
|
|
9622
|
-
'let { assert!= } = import(
|
|
9623
|
-
'let { assert!= } = import(
|
|
9875
|
+
'let { assert!= } = import(assertion);\ntry assert!=(0, 0, "Expected different values") catch (e) e.message end',
|
|
9876
|
+
'let { assert!= } = import(assertion);\ntry assert!=(0, 0) catch (e) e.message end',
|
|
9877
|
+
'let { assert!= } = import(assertion);\ntry 0 assert!= 0 catch (e) e.message end',
|
|
9878
|
+
'let { assert!= } = import(assertion);\ntry assert!=(0, 1) catch (e) e.message end',
|
|
9624
9879
|
],
|
|
9625
|
-
seeAlso: ['
|
|
9880
|
+
seeAlso: ['assertion.assert='],
|
|
9626
9881
|
hideOperatorForm: true,
|
|
9627
9882
|
},
|
|
9628
9883
|
'assert=': {
|
|
9629
|
-
category: '
|
|
9884
|
+
category: 'assertion',
|
|
9630
9885
|
description: 'If $a is not structural equal to $b it throws `AssertionError`.',
|
|
9631
9886
|
returns: {
|
|
9632
9887
|
type: 'null',
|
|
@@ -9658,15 +9913,15 @@ const moduleDocs$6 = {
|
|
|
9658
9913
|
},
|
|
9659
9914
|
],
|
|
9660
9915
|
examples: [
|
|
9661
|
-
'let { assert= } = import(
|
|
9662
|
-
'let { assert= } = import(
|
|
9663
|
-
'let { assert= } = import(
|
|
9916
|
+
'let { assert= } = import(assertion);\ntry assert=({ "a": 1 }, { "a": 2 }, "Expected equal values") catch (e) e.message end',
|
|
9917
|
+
'let { assert= } = import(assertion);\ntry assert=({ "a": 1 }, { "a": 2 }) catch (e) e.message end',
|
|
9918
|
+
'let { assert= } = import(assertion);\ntry assert=({ "a": 1 }, { "a": 1 }) catch (e) e.message end',
|
|
9664
9919
|
],
|
|
9665
|
-
seeAlso: ['
|
|
9920
|
+
seeAlso: ['assertion.assert!='],
|
|
9666
9921
|
hideOperatorForm: true,
|
|
9667
9922
|
},
|
|
9668
9923
|
'assert-gt': {
|
|
9669
|
-
category: '
|
|
9924
|
+
category: 'assertion',
|
|
9670
9925
|
description: 'If $a is not greater than $b it throws `AssertionError`.',
|
|
9671
9926
|
returns: {
|
|
9672
9927
|
type: 'null',
|
|
@@ -9698,15 +9953,15 @@ const moduleDocs$6 = {
|
|
|
9698
9953
|
},
|
|
9699
9954
|
],
|
|
9700
9955
|
examples: [
|
|
9701
|
-
'let { assert-gt } = import(
|
|
9702
|
-
'let { assert-gt } = import(
|
|
9703
|
-
'let { assert-gt } = import(
|
|
9956
|
+
'let { assert-gt } = import(assertion);\ntry assert-gt(0, 1, "Expected greater value") catch (e) e.message end',
|
|
9957
|
+
'let { assert-gt } = import(assertion);\ntry assert-gt(0, 0) catch (e) e.message end',
|
|
9958
|
+
'let { assert-gt } = import(assertion);\ntry assert-gt(1, 0) catch (e) e.message end',
|
|
9704
9959
|
],
|
|
9705
|
-
seeAlso: ['
|
|
9960
|
+
seeAlso: ['assertion.assert-lt', 'assertion.assert-gte', 'assertion.assert-lte'],
|
|
9706
9961
|
hideOperatorForm: true,
|
|
9707
9962
|
},
|
|
9708
9963
|
'assert-lt': {
|
|
9709
|
-
category: '
|
|
9964
|
+
category: 'assertion',
|
|
9710
9965
|
description: 'If $a is not less than $b it throws `AssertionError`.',
|
|
9711
9966
|
returns: {
|
|
9712
9967
|
type: 'null',
|
|
@@ -9738,15 +9993,15 @@ const moduleDocs$6 = {
|
|
|
9738
9993
|
},
|
|
9739
9994
|
],
|
|
9740
9995
|
examples: [
|
|
9741
|
-
'let { assert-lt } = import(
|
|
9742
|
-
'let { assert-lt } = import(
|
|
9743
|
-
'let { assert-lt } = import(
|
|
9996
|
+
'let { assert-lt } = import(assertion);\ntry assert-lt(1, 0, "Expected smaller value value") catch (e) e.message end',
|
|
9997
|
+
'let { assert-lt } = import(assertion);\ntry assert-lt(1, 1) catch (e) e.message end',
|
|
9998
|
+
'let { assert-lt } = import(assertion);\ntry assert-lt(0, 1) catch (e) e.message end',
|
|
9744
9999
|
],
|
|
9745
|
-
seeAlso: ['
|
|
10000
|
+
seeAlso: ['assertion.assert-gt', 'assertion.assert-lte', 'assertion.assert-gte'],
|
|
9746
10001
|
hideOperatorForm: true,
|
|
9747
10002
|
},
|
|
9748
10003
|
'assert-gte': {
|
|
9749
|
-
category: '
|
|
10004
|
+
category: 'assertion',
|
|
9750
10005
|
description: 'If $a is less than $b it throws `AssertionError`.',
|
|
9751
10006
|
returns: {
|
|
9752
10007
|
type: 'null',
|
|
@@ -9778,15 +10033,15 @@ const moduleDocs$6 = {
|
|
|
9778
10033
|
},
|
|
9779
10034
|
],
|
|
9780
10035
|
examples: [
|
|
9781
|
-
'let { assert-gte } = import(
|
|
9782
|
-
'let { assert-gte } = import(
|
|
9783
|
-
'let { assert-gte } = import(
|
|
10036
|
+
'let { assert-gte } = import(assertion);\ntry assert-gte(0, 1, "Expected greater value") catch (e) e.message end',
|
|
10037
|
+
'let { assert-gte } = import(assertion);\ntry assert-gte(0, 1) catch (e) e.message end',
|
|
10038
|
+
'let { assert-gte } = import(assertion);\ntry assert-gte(1, 1) catch (e) e.message end',
|
|
9784
10039
|
],
|
|
9785
|
-
seeAlso: ['
|
|
10040
|
+
seeAlso: ['assertion.assert-lte', 'assertion.assert-gt', 'assertion.assert-lt'],
|
|
9786
10041
|
hideOperatorForm: true,
|
|
9787
10042
|
},
|
|
9788
10043
|
'assert-lte': {
|
|
9789
|
-
category: '
|
|
10044
|
+
category: 'assertion',
|
|
9790
10045
|
description: 'If $a is grater than $b it throws `AssertionError`.',
|
|
9791
10046
|
returns: {
|
|
9792
10047
|
type: 'null',
|
|
@@ -9818,15 +10073,15 @@ const moduleDocs$6 = {
|
|
|
9818
10073
|
},
|
|
9819
10074
|
],
|
|
9820
10075
|
examples: [
|
|
9821
|
-
'let { assert-lte } = import(
|
|
9822
|
-
'let { assert-lte } = import(
|
|
9823
|
-
'let { assert-lte } = import(
|
|
10076
|
+
'let { assert-lte } = import(assertion);\ntry assert-lte(1, 0, "Expected smaller value value") catch (e) e.message end',
|
|
10077
|
+
'let { assert-lte } = import(assertion);\ntry assert-lte(1, 0) catch (e) e.message end',
|
|
10078
|
+
'let { assert-lte } = import(assertion);\ntry assert-lte(1, 1) catch (e) e.message end',
|
|
9824
10079
|
],
|
|
9825
|
-
seeAlso: ['
|
|
10080
|
+
seeAlso: ['assertion.assert-gte', 'assertion.assert-lt', 'assertion.assert-gt'],
|
|
9826
10081
|
hideOperatorForm: true,
|
|
9827
10082
|
},
|
|
9828
10083
|
'assert-true': {
|
|
9829
|
-
category: '
|
|
10084
|
+
category: 'assertion',
|
|
9830
10085
|
description: 'If $value is not `true` it throws `AssertionError`.',
|
|
9831
10086
|
returns: {
|
|
9832
10087
|
type: 'null',
|
|
@@ -9853,15 +10108,15 @@ const moduleDocs$6 = {
|
|
|
9853
10108
|
},
|
|
9854
10109
|
],
|
|
9855
10110
|
examples: [
|
|
9856
|
-
'let { assert-true } = import(
|
|
9857
|
-
'let { assert-true } = import(
|
|
9858
|
-
'let { assert-true } = import(
|
|
10111
|
+
'let { assert-true } = import(assertion);\ntry assert-true(false, "Expected true") catch (e) e.message end',
|
|
10112
|
+
'let { assert-true } = import(assertion);\ntry assert-true(false) catch (e) e.message end',
|
|
10113
|
+
'let { assert-true } = import(assertion);\ntry assert-true(true) catch (e) e.message end',
|
|
9859
10114
|
],
|
|
9860
|
-
seeAlso: ['
|
|
10115
|
+
seeAlso: ['assertion.assert-false', 'assertion.assert-truthy', 'assertion.assert-falsy', 'assert', 'assertion.assert-boolean'],
|
|
9861
10116
|
hideOperatorForm: true,
|
|
9862
10117
|
},
|
|
9863
10118
|
'assert-false': {
|
|
9864
|
-
category: '
|
|
10119
|
+
category: 'assertion',
|
|
9865
10120
|
description: 'If $value is not `false` it throws `AssertionError`.',
|
|
9866
10121
|
returns: {
|
|
9867
10122
|
type: 'null',
|
|
@@ -9888,15 +10143,15 @@ const moduleDocs$6 = {
|
|
|
9888
10143
|
},
|
|
9889
10144
|
],
|
|
9890
10145
|
examples: [
|
|
9891
|
-
'let { assert-false } = import(
|
|
9892
|
-
'let { assert-false } = import(
|
|
9893
|
-
'let { assert-false } = import(
|
|
10146
|
+
'let { assert-false } = import(assertion);\ntry assert-false(true, "Expected false") catch (e) e.message end',
|
|
10147
|
+
'let { assert-false } = import(assertion);\ntry assert-false(true) catch (e) e.message end',
|
|
10148
|
+
'let { assert-false } = import(assertion);\ntry assert-false(false) catch (e) e.message end',
|
|
9894
10149
|
],
|
|
9895
|
-
seeAlso: ['
|
|
10150
|
+
seeAlso: ['assertion.assert-true', 'assertion.assert-falsy', 'assertion.assert-truthy', 'assertion.assert-boolean'],
|
|
9896
10151
|
hideOperatorForm: true,
|
|
9897
10152
|
},
|
|
9898
10153
|
'assert-truthy': {
|
|
9899
|
-
category: '
|
|
10154
|
+
category: 'assertion',
|
|
9900
10155
|
description: 'If $value is not `truthy` it throws `AssertionError`.',
|
|
9901
10156
|
returns: {
|
|
9902
10157
|
type: 'null',
|
|
@@ -9923,22 +10178,22 @@ const moduleDocs$6 = {
|
|
|
9923
10178
|
},
|
|
9924
10179
|
],
|
|
9925
10180
|
examples: [
|
|
9926
|
-
'let { assert-truthy } = import(
|
|
9927
|
-
'let { assert-truthy } = import(
|
|
9928
|
-
'let { assert-truthy } = import(
|
|
9929
|
-
'let { assert-truthy } = import(
|
|
9930
|
-
'let { assert-truthy } = import(
|
|
9931
|
-
'let { assert-truthy } = import(
|
|
9932
|
-
'let { assert-truthy } = import(
|
|
9933
|
-
'let { assert-truthy } = import(
|
|
9934
|
-
'let { assert-truthy } = import(
|
|
9935
|
-
'let { assert-truthy } = import(
|
|
10181
|
+
'let { assert-truthy } = import(assertion);\ntry assert-truthy(false, "Expected truthy") catch (e) e.message end',
|
|
10182
|
+
'let { assert-truthy } = import(assertion);\ntry assert-truthy(false) catch (e) e.message end',
|
|
10183
|
+
'let { assert-truthy } = import(assertion);\ntry assert-truthy(0) catch (e) e.message end',
|
|
10184
|
+
'let { assert-truthy } = import(assertion);\ntry assert-truthy(null) catch (e) e.message end',
|
|
10185
|
+
'let { assert-truthy } = import(assertion);\ntry assert-truthy("") catch (e) e.message end',
|
|
10186
|
+
'let { assert-truthy } = import(assertion);\ntry assert-truthy(true) catch (e) e.message end',
|
|
10187
|
+
'let { assert-truthy } = import(assertion);\ntry assert-truthy(1) catch (e) e.message end',
|
|
10188
|
+
'let { assert-truthy } = import(assertion);\ntry assert-truthy("x") catch (e) e.message end',
|
|
10189
|
+
'let { assert-truthy } = import(assertion);\ntry assert-truthy([]) catch (e) e.message end',
|
|
10190
|
+
'let { assert-truthy } = import(assertion);\ntry assert-truthy(nd) catch (e) e.message end',
|
|
9936
10191
|
],
|
|
9937
|
-
seeAlso: ['
|
|
10192
|
+
seeAlso: ['assertion.assert-falsy', 'assertion.assert-true', 'assertion.assert-false', 'assert', 'assertion.assert-null'],
|
|
9938
10193
|
hideOperatorForm: true,
|
|
9939
10194
|
},
|
|
9940
10195
|
'assert-falsy': {
|
|
9941
|
-
category: '
|
|
10196
|
+
category: 'assertion',
|
|
9942
10197
|
description: 'If $value is not `falsy` it throws `AssertionError`.',
|
|
9943
10198
|
returns: {
|
|
9944
10199
|
type: 'null',
|
|
@@ -9965,21 +10220,21 @@ const moduleDocs$6 = {
|
|
|
9965
10220
|
},
|
|
9966
10221
|
],
|
|
9967
10222
|
examples: [
|
|
9968
|
-
'let { assert-falsy } = import(
|
|
9969
|
-
'let { assert-falsy } = import(
|
|
9970
|
-
'let { assert-falsy } = import(
|
|
9971
|
-
'let { assert-falsy } = import(
|
|
9972
|
-
'let { assert-falsy } = import(
|
|
9973
|
-
'let { assert-falsy } = import(
|
|
9974
|
-
'let { assert-falsy } = import(
|
|
9975
|
-
'let { assert-falsy } = import(
|
|
9976
|
-
'let { assert-falsy } = import(
|
|
10223
|
+
'let { assert-falsy } = import(assertion);\ntry assert-falsy(true, "Expected falsy") catch (e) e.message end',
|
|
10224
|
+
'let { assert-falsy } = import(assertion);\ntry assert-falsy("x") catch (e) e.message end',
|
|
10225
|
+
'let { assert-falsy } = import(assertion);\ntry assert-falsy([]) catch (e) e.message end',
|
|
10226
|
+
'let { assert-falsy } = import(assertion);\ntry assert-falsy(nd) catch (e) e.message end',
|
|
10227
|
+
'let { assert-falsy } = import(assertion);\ntry assert-falsy(1) catch (e) e.message end',
|
|
10228
|
+
'let { assert-falsy } = import(assertion);\ntry assert-falsy(false) catch (e) e.message end',
|
|
10229
|
+
'let { assert-falsy } = import(assertion);\ntry assert-falsy(0) catch (e) e.message end',
|
|
10230
|
+
'let { assert-falsy } = import(assertion);\ntry assert-falsy(null) catch (e) e.message end',
|
|
10231
|
+
'let { assert-falsy } = import(assertion);\ntry assert-falsy("") catch (e) e.message end',
|
|
9977
10232
|
],
|
|
9978
|
-
seeAlso: ['
|
|
10233
|
+
seeAlso: ['assertion.assert-truthy', 'assertion.assert-false', 'assertion.assert-true', 'assertion.assert-null'],
|
|
9979
10234
|
hideOperatorForm: true,
|
|
9980
10235
|
},
|
|
9981
10236
|
'assert-null': {
|
|
9982
|
-
category: '
|
|
10237
|
+
category: 'assertion',
|
|
9983
10238
|
description: 'If $value is not `null` it throws `AssertionError`.',
|
|
9984
10239
|
returns: {
|
|
9985
10240
|
type: 'null',
|
|
@@ -10006,21 +10261,21 @@ const moduleDocs$6 = {
|
|
|
10006
10261
|
},
|
|
10007
10262
|
],
|
|
10008
10263
|
examples: [
|
|
10009
|
-
'let { assert-null } = import(
|
|
10010
|
-
'let { assert-null } = import(
|
|
10011
|
-
'let { assert-null } = import(
|
|
10012
|
-
'let { assert-null } = import(
|
|
10013
|
-
'let { assert-null } = import(
|
|
10014
|
-
'let { assert-null } = import(
|
|
10015
|
-
'let { assert-null } = import(
|
|
10016
|
-
'let { assert-null } = import(
|
|
10017
|
-
'let { assert-null } = import(
|
|
10264
|
+
'let { assert-null } = import(assertion);\ntry assert-null(null) catch (e) e.message end',
|
|
10265
|
+
'let { assert-null } = import(assertion);\ntry assert-null(true, "Expected null") catch (e) e.message end',
|
|
10266
|
+
'let { assert-null } = import(assertion);\ntry assert-null("x") catch (e) e.message end',
|
|
10267
|
+
'let { assert-null } = import(assertion);\ntry assert-null([]) catch (e) e.message end',
|
|
10268
|
+
'let { assert-null } = import(assertion);\ntry assert-null(nd) catch (e) e.message end',
|
|
10269
|
+
'let { assert-null } = import(assertion);\ntry assert-null(1) catch (e) e.message end',
|
|
10270
|
+
'let { assert-null } = import(assertion);\ntry assert-null(false) catch (e) e.message end',
|
|
10271
|
+
'let { assert-null } = import(assertion);\ntry assert-null(0) catch (e) e.message end',
|
|
10272
|
+
'let { assert-null } = import(assertion);\ntry assert-null("") catch (e) e.message end',
|
|
10018
10273
|
],
|
|
10019
|
-
seeAlso: ['
|
|
10274
|
+
seeAlso: ['assertion.assert-truthy', 'assertion.assert-falsy'],
|
|
10020
10275
|
hideOperatorForm: true,
|
|
10021
10276
|
},
|
|
10022
10277
|
'assert-throws': {
|
|
10023
|
-
category: '
|
|
10278
|
+
category: 'assertion',
|
|
10024
10279
|
description: 'If $fun does not throw, it throws `AssertionError`.',
|
|
10025
10280
|
returns: {
|
|
10026
10281
|
type: 'null',
|
|
@@ -10047,14 +10302,14 @@ const moduleDocs$6 = {
|
|
|
10047
10302
|
},
|
|
10048
10303
|
],
|
|
10049
10304
|
examples: [
|
|
10050
|
-
'let { assert-throws } = import(
|
|
10051
|
-
'let { assert-throws } = import(
|
|
10305
|
+
'let { assert-throws } = import(assertion);\nassert-throws(-> throw("Error"))',
|
|
10306
|
+
'let { assert-throws } = import(assertion);\ntry assert-throws(-> identity("Error")) catch (e) e.message end',
|
|
10052
10307
|
],
|
|
10053
|
-
seeAlso: ['
|
|
10308
|
+
seeAlso: ['assertion.assert-throws-error', 'assertion.assert-not-throws'],
|
|
10054
10309
|
hideOperatorForm: true,
|
|
10055
10310
|
},
|
|
10056
10311
|
'assert-throws-error': {
|
|
10057
|
-
category: '
|
|
10312
|
+
category: 'assertion',
|
|
10058
10313
|
description: 'If $fun does not throw $error-message, it throws `AssertionError`.',
|
|
10059
10314
|
returns: {
|
|
10060
10315
|
type: 'null',
|
|
@@ -10086,14 +10341,14 @@ const moduleDocs$6 = {
|
|
|
10086
10341
|
},
|
|
10087
10342
|
],
|
|
10088
10343
|
examples: [
|
|
10089
|
-
'let { assert-throws-error } = import(
|
|
10090
|
-
'let { assert-throws-error } = import(
|
|
10344
|
+
'let { assert-throws-error } = import(assertion);\ntry assert-throws-error(-> throw("Error"), "Error") catch (e) e.message end',
|
|
10345
|
+
'let { assert-throws-error } = import(assertion);\ntry assert-throws-error(-> identity("Error"), "Error") catch (e) e.message end',
|
|
10091
10346
|
],
|
|
10092
|
-
seeAlso: ['
|
|
10347
|
+
seeAlso: ['assertion.assert-throws', 'assertion.assert-not-throws'],
|
|
10093
10348
|
hideOperatorForm: true,
|
|
10094
10349
|
},
|
|
10095
10350
|
'assert-not-throws': {
|
|
10096
|
-
category: '
|
|
10351
|
+
category: 'assertion',
|
|
10097
10352
|
description: 'If $fun throws, it throws `AssertionError`.',
|
|
10098
10353
|
returns: {
|
|
10099
10354
|
type: 'null',
|
|
@@ -10120,14 +10375,14 @@ const moduleDocs$6 = {
|
|
|
10120
10375
|
},
|
|
10121
10376
|
],
|
|
10122
10377
|
examples: [
|
|
10123
|
-
'let { assert-not-throws } = import(
|
|
10124
|
-
'let { assert-not-throws } = import(
|
|
10378
|
+
'let { assert-not-throws } = import(assertion);\ntry assert-not-throws(-> identity("Error")) catch (e) e.message end',
|
|
10379
|
+
'let { assert-not-throws } = import(assertion);\ntry assert-not-throws(-> throw("Error")) catch (e) e.message end',
|
|
10125
10380
|
],
|
|
10126
|
-
seeAlso: ['
|
|
10381
|
+
seeAlso: ['assertion.assert-throws', 'assertion.assert-throws-error'],
|
|
10127
10382
|
hideOperatorForm: true,
|
|
10128
10383
|
},
|
|
10129
10384
|
'assert-array': {
|
|
10130
|
-
category: '
|
|
10385
|
+
category: 'assertion',
|
|
10131
10386
|
description: 'If $value is not an `array` it throws `AssertionError`.',
|
|
10132
10387
|
returns: {
|
|
10133
10388
|
type: 'null',
|
|
@@ -10154,15 +10409,15 @@ const moduleDocs$6 = {
|
|
|
10154
10409
|
},
|
|
10155
10410
|
],
|
|
10156
10411
|
examples: [
|
|
10157
|
-
'let { assert-array } = import(
|
|
10158
|
-
'let { assert-array } = import(
|
|
10159
|
-
'let { assert-array } = import(
|
|
10412
|
+
'let { assert-array } = import(assertion);\ntry assert-array([1, 2, 3]) catch (e) e.message end',
|
|
10413
|
+
'let { assert-array } = import(assertion);\ntry assert-array("string") catch (e) e.message end',
|
|
10414
|
+
'let { assert-array } = import(assertion);\ntry assert-array(42, "Expected an array") catch (e) e.message end',
|
|
10160
10415
|
],
|
|
10161
|
-
seeAlso: ['
|
|
10416
|
+
seeAlso: ['assertion.assert-object', 'assertion.assert-collection', 'assertion.assert-sequence'],
|
|
10162
10417
|
hideOperatorForm: true,
|
|
10163
10418
|
},
|
|
10164
10419
|
'assert-boolean': {
|
|
10165
|
-
category: '
|
|
10420
|
+
category: 'assertion',
|
|
10166
10421
|
description: 'If $value is not a `boolean` it throws `AssertionError`.',
|
|
10167
10422
|
returns: {
|
|
10168
10423
|
type: 'null',
|
|
@@ -10189,15 +10444,15 @@ const moduleDocs$6 = {
|
|
|
10189
10444
|
},
|
|
10190
10445
|
],
|
|
10191
10446
|
examples: [
|
|
10192
|
-
'let { assert-boolean } = import(
|
|
10193
|
-
'let { assert-boolean } = import(
|
|
10194
|
-
'let { assert-boolean } = import(
|
|
10447
|
+
'let { assert-boolean } = import(assertion);\ntry assert-boolean(true) catch (e) e.message end',
|
|
10448
|
+
'let { assert-boolean } = import(assertion);\ntry assert-boolean(false) catch (e) e.message end',
|
|
10449
|
+
'let { assert-boolean } = import(assertion);\ntry assert-boolean(1, "Expected a boolean") catch (e) e.message end',
|
|
10195
10450
|
],
|
|
10196
|
-
seeAlso: ['
|
|
10451
|
+
seeAlso: ['assertion.assert-true', 'assertion.assert-false', 'assertion.assert-number', 'assertion.assert-string'],
|
|
10197
10452
|
hideOperatorForm: true,
|
|
10198
10453
|
},
|
|
10199
10454
|
'assert-collection': {
|
|
10200
|
-
category: '
|
|
10455
|
+
category: 'assertion',
|
|
10201
10456
|
description: 'If $value is not a `collection` (array, object, or string) it throws `AssertionError`.',
|
|
10202
10457
|
returns: {
|
|
10203
10458
|
type: 'null',
|
|
@@ -10224,16 +10479,16 @@ const moduleDocs$6 = {
|
|
|
10224
10479
|
},
|
|
10225
10480
|
],
|
|
10226
10481
|
examples: [
|
|
10227
|
-
'let { assert-collection } = import(
|
|
10228
|
-
'let { assert-collection } = import(
|
|
10229
|
-
'let { assert-collection } = import(
|
|
10230
|
-
'let { assert-collection } = import(
|
|
10482
|
+
'let { assert-collection } = import(assertion);\ntry assert-collection([1, 2]) catch (e) e.message end',
|
|
10483
|
+
'let { assert-collection } = import(assertion);\ntry assert-collection({ a: 1 }) catch (e) e.message end',
|
|
10484
|
+
'let { assert-collection } = import(assertion);\ntry assert-collection("hello") catch (e) e.message end',
|
|
10485
|
+
'let { assert-collection } = import(assertion);\ntry assert-collection(42, "Expected a collection") catch (e) e.message end',
|
|
10231
10486
|
],
|
|
10232
|
-
seeAlso: ['
|
|
10487
|
+
seeAlso: ['assertion.assert-sequence', 'assertion.assert-array', 'assertion.assert-object'],
|
|
10233
10488
|
hideOperatorForm: true,
|
|
10234
10489
|
},
|
|
10235
10490
|
'assert-function': {
|
|
10236
|
-
category: '
|
|
10491
|
+
category: 'assertion',
|
|
10237
10492
|
description: 'If $value is not a `function` it throws `AssertionError`.',
|
|
10238
10493
|
returns: {
|
|
10239
10494
|
type: 'null',
|
|
@@ -10260,14 +10515,14 @@ const moduleDocs$6 = {
|
|
|
10260
10515
|
},
|
|
10261
10516
|
],
|
|
10262
10517
|
examples: [
|
|
10263
|
-
'let { assert-function } = import(
|
|
10264
|
-
'let { assert-function } = import(
|
|
10518
|
+
'let { assert-function } = import(assertion);\ntry assert-function(-> $ + 1) catch (e) e.message end',
|
|
10519
|
+
'let { assert-function } = import(assertion);\ntry assert-function(42, "Expected a function") catch (e) e.message end',
|
|
10265
10520
|
],
|
|
10266
|
-
seeAlso: ['
|
|
10521
|
+
seeAlso: ['assertion.assert-number', 'assertion.assert-string'],
|
|
10267
10522
|
hideOperatorForm: true,
|
|
10268
10523
|
},
|
|
10269
10524
|
'assert-grid': {
|
|
10270
|
-
category: '
|
|
10525
|
+
category: 'assertion',
|
|
10271
10526
|
description: 'If $value is not a `grid` it throws `AssertionError`.',
|
|
10272
10527
|
returns: {
|
|
10273
10528
|
type: 'null',
|
|
@@ -10294,14 +10549,14 @@ const moduleDocs$6 = {
|
|
|
10294
10549
|
},
|
|
10295
10550
|
],
|
|
10296
10551
|
examples: [
|
|
10297
|
-
'let { assert-grid } = import(
|
|
10298
|
-
'let { assert-grid } = import(
|
|
10552
|
+
'let { assert-grid } = import(assertion);\ntry assert-grid([[1, 2], [3, 4]]) catch (e) e.message end',
|
|
10553
|
+
'let { assert-grid } = import(assertion);\ntry assert-grid([1, 2], "Expected a grid") catch (e) e.message end',
|
|
10299
10554
|
],
|
|
10300
|
-
seeAlso: ['
|
|
10555
|
+
seeAlso: ['assertion.assert-matrix', 'assertion.assert-vector'],
|
|
10301
10556
|
hideOperatorForm: true,
|
|
10302
10557
|
},
|
|
10303
10558
|
'assert-integer': {
|
|
10304
|
-
category: '
|
|
10559
|
+
category: 'assertion',
|
|
10305
10560
|
description: 'If $value is not an `integer` it throws `AssertionError`.',
|
|
10306
10561
|
returns: {
|
|
10307
10562
|
type: 'null',
|
|
@@ -10328,14 +10583,14 @@ const moduleDocs$6 = {
|
|
|
10328
10583
|
},
|
|
10329
10584
|
],
|
|
10330
10585
|
examples: [
|
|
10331
|
-
'let { assert-integer } = import(
|
|
10332
|
-
'let { assert-integer } = import(
|
|
10586
|
+
'let { assert-integer } = import(assertion);\ntry assert-integer(42) catch (e) e.message end',
|
|
10587
|
+
'let { assert-integer } = import(assertion);\ntry assert-integer(3.14, "Expected an integer") catch (e) e.message end',
|
|
10333
10588
|
],
|
|
10334
|
-
seeAlso: ['
|
|
10589
|
+
seeAlso: ['assertion.assert-number'],
|
|
10335
10590
|
hideOperatorForm: true,
|
|
10336
10591
|
},
|
|
10337
10592
|
'assert-matrix': {
|
|
10338
|
-
category: '
|
|
10593
|
+
category: 'assertion',
|
|
10339
10594
|
description: 'If $value is not a `matrix` it throws `AssertionError`.',
|
|
10340
10595
|
returns: {
|
|
10341
10596
|
type: 'null',
|
|
@@ -10362,14 +10617,14 @@ const moduleDocs$6 = {
|
|
|
10362
10617
|
},
|
|
10363
10618
|
],
|
|
10364
10619
|
examples: [
|
|
10365
|
-
'let { assert-matrix } = import(
|
|
10366
|
-
'let { assert-matrix } = import(
|
|
10620
|
+
'let { assert-matrix } = import(assertion);\ntry assert-matrix([[1, 2], [3, 4]]) catch (e) e.message end',
|
|
10621
|
+
'let { assert-matrix } = import(assertion);\ntry assert-matrix([1, 2], "Expected a matrix") catch (e) e.message end',
|
|
10367
10622
|
],
|
|
10368
|
-
seeAlso: ['
|
|
10623
|
+
seeAlso: ['assertion.assert-vector', 'assertion.assert-grid'],
|
|
10369
10624
|
hideOperatorForm: true,
|
|
10370
10625
|
},
|
|
10371
10626
|
'assert-number': {
|
|
10372
|
-
category: '
|
|
10627
|
+
category: 'assertion',
|
|
10373
10628
|
description: 'If $value is not a `number` it throws `AssertionError`.',
|
|
10374
10629
|
returns: {
|
|
10375
10630
|
type: 'null',
|
|
@@ -10396,14 +10651,14 @@ const moduleDocs$6 = {
|
|
|
10396
10651
|
},
|
|
10397
10652
|
],
|
|
10398
10653
|
examples: [
|
|
10399
|
-
'let { assert-number } = import(
|
|
10400
|
-
'let { assert-number } = import(
|
|
10654
|
+
'let { assert-number } = import(assertion);\ntry assert-number(42) catch (e) e.message end',
|
|
10655
|
+
'let { assert-number } = import(assertion);\ntry assert-number("hello", "Expected a number") catch (e) e.message end',
|
|
10401
10656
|
],
|
|
10402
|
-
seeAlso: ['
|
|
10657
|
+
seeAlso: ['assertion.assert-integer', 'assertion.assert-boolean', 'assertion.assert-string', 'assertion.assert-function'],
|
|
10403
10658
|
hideOperatorForm: true,
|
|
10404
10659
|
},
|
|
10405
10660
|
'assert-object': {
|
|
10406
|
-
category: '
|
|
10661
|
+
category: 'assertion',
|
|
10407
10662
|
description: 'If $value is not an `object` it throws `AssertionError`.',
|
|
10408
10663
|
returns: {
|
|
10409
10664
|
type: 'null',
|
|
@@ -10430,14 +10685,14 @@ const moduleDocs$6 = {
|
|
|
10430
10685
|
},
|
|
10431
10686
|
],
|
|
10432
10687
|
examples: [
|
|
10433
|
-
'let { assert-object } = import(
|
|
10434
|
-
'let { assert-object } = import(
|
|
10688
|
+
'let { assert-object } = import(assertion);\ntry assert-object({ a: 1 }) catch (e) e.message end',
|
|
10689
|
+
'let { assert-object } = import(assertion);\ntry assert-object([1, 2], "Expected an object") catch (e) e.message end',
|
|
10435
10690
|
],
|
|
10436
|
-
seeAlso: ['
|
|
10691
|
+
seeAlso: ['assertion.assert-array', 'assertion.assert-collection'],
|
|
10437
10692
|
hideOperatorForm: true,
|
|
10438
10693
|
},
|
|
10439
10694
|
'assert-regexp': {
|
|
10440
|
-
category: '
|
|
10695
|
+
category: 'assertion',
|
|
10441
10696
|
description: 'If $value is not a `regexp` it throws `AssertionError`.',
|
|
10442
10697
|
returns: {
|
|
10443
10698
|
type: 'null',
|
|
@@ -10464,14 +10719,14 @@ const moduleDocs$6 = {
|
|
|
10464
10719
|
},
|
|
10465
10720
|
],
|
|
10466
10721
|
examples: [
|
|
10467
|
-
'let { assert-regexp } = import(
|
|
10468
|
-
'let { assert-regexp } = import(
|
|
10722
|
+
'let { assert-regexp } = import(assertion);\ntry assert-regexp(#"^start") catch (e) e.message end',
|
|
10723
|
+
'let { assert-regexp } = import(assertion);\ntry assert-regexp("hello", "Expected a regexp") catch (e) e.message end',
|
|
10469
10724
|
],
|
|
10470
|
-
seeAlso: ['
|
|
10725
|
+
seeAlso: ['assertion.assert-string'],
|
|
10471
10726
|
hideOperatorForm: true,
|
|
10472
10727
|
},
|
|
10473
10728
|
'assert-sequence': {
|
|
10474
|
-
category: '
|
|
10729
|
+
category: 'assertion',
|
|
10475
10730
|
description: 'If $value is not a `sequence` (array or string) it throws `AssertionError`.',
|
|
10476
10731
|
returns: {
|
|
10477
10732
|
type: 'null',
|
|
@@ -10498,15 +10753,15 @@ const moduleDocs$6 = {
|
|
|
10498
10753
|
},
|
|
10499
10754
|
],
|
|
10500
10755
|
examples: [
|
|
10501
|
-
'let { assert-sequence } = import(
|
|
10502
|
-
'let { assert-sequence } = import(
|
|
10503
|
-
'let { assert-sequence } = import(
|
|
10756
|
+
'let { assert-sequence } = import(assertion);\ntry assert-sequence([1, 2]) catch (e) e.message end',
|
|
10757
|
+
'let { assert-sequence } = import(assertion);\ntry assert-sequence("hello") catch (e) e.message end',
|
|
10758
|
+
'let { assert-sequence } = import(assertion);\ntry assert-sequence({ a: 1 }, "Expected a sequence") catch (e) e.message end',
|
|
10504
10759
|
],
|
|
10505
|
-
seeAlso: ['
|
|
10760
|
+
seeAlso: ['assertion.assert-collection', 'assertion.assert-array'],
|
|
10506
10761
|
hideOperatorForm: true,
|
|
10507
10762
|
},
|
|
10508
10763
|
'assert-string': {
|
|
10509
|
-
category: '
|
|
10764
|
+
category: 'assertion',
|
|
10510
10765
|
description: 'If $value is not a `string` it throws `AssertionError`.',
|
|
10511
10766
|
returns: {
|
|
10512
10767
|
type: 'null',
|
|
@@ -10533,14 +10788,14 @@ const moduleDocs$6 = {
|
|
|
10533
10788
|
},
|
|
10534
10789
|
],
|
|
10535
10790
|
examples: [
|
|
10536
|
-
'let { assert-string } = import(
|
|
10537
|
-
'let { assert-string } = import(
|
|
10791
|
+
'let { assert-string } = import(assertion);\ntry assert-string("hello") catch (e) e.message end',
|
|
10792
|
+
'let { assert-string } = import(assertion);\ntry assert-string(42, "Expected a string") catch (e) e.message end',
|
|
10538
10793
|
],
|
|
10539
|
-
seeAlso: ['
|
|
10794
|
+
seeAlso: ['assertion.assert-number', 'assertion.assert-boolean', 'assertion.assert-regexp', 'assertion.assert-function'],
|
|
10540
10795
|
hideOperatorForm: true,
|
|
10541
10796
|
},
|
|
10542
10797
|
'assert-vector': {
|
|
10543
|
-
category: '
|
|
10798
|
+
category: 'assertion',
|
|
10544
10799
|
description: 'If $value is not a `vector` it throws `AssertionError`.',
|
|
10545
10800
|
returns: {
|
|
10546
10801
|
type: 'null',
|
|
@@ -10567,26 +10822,15 @@ const moduleDocs$6 = {
|
|
|
10567
10822
|
},
|
|
10568
10823
|
],
|
|
10569
10824
|
examples: [
|
|
10570
|
-
'let { assert-vector } = import(
|
|
10571
|
-
'let { assert-vector } = import(
|
|
10825
|
+
'let { assert-vector } = import(assertion);\ntry assert-vector([1, 2, 3]) catch (e) e.message end',
|
|
10826
|
+
'let { assert-vector } = import(assertion);\ntry assert-vector(["a", "b"], "Expected a vector") catch (e) e.message end',
|
|
10572
10827
|
],
|
|
10573
|
-
seeAlso: ['
|
|
10828
|
+
seeAlso: ['assertion.assert-matrix', 'assertion.assert-grid'],
|
|
10574
10829
|
hideOperatorForm: true,
|
|
10575
10830
|
},
|
|
10576
10831
|
};
|
|
10577
10832
|
|
|
10578
10833
|
const assertNormalExpression = {
|
|
10579
|
-
'assert': {
|
|
10580
|
-
evaluate: (params, sourceCodeInfo) => {
|
|
10581
|
-
const value = params[0];
|
|
10582
|
-
const message = params.length === 2 ? params[1] : `${value}`;
|
|
10583
|
-
assertString(message, sourceCodeInfo);
|
|
10584
|
-
if (!value)
|
|
10585
|
-
throw new AssertionError(message, sourceCodeInfo);
|
|
10586
|
-
return asAny(value, sourceCodeInfo);
|
|
10587
|
-
},
|
|
10588
|
-
arity: { min: 1, max: 2 },
|
|
10589
|
-
},
|
|
10590
10834
|
'assert=': {
|
|
10591
10835
|
evaluate: ([first, second, message], sourceCodeInfo) => {
|
|
10592
10836
|
if (message !== undefined) {
|
|
@@ -10964,12 +11208,12 @@ for (const [key, docs] of Object.entries(moduleDocs$6)) {
|
|
|
10964
11208
|
assertNormalExpression[key].docs = docs;
|
|
10965
11209
|
}
|
|
10966
11210
|
const assertModule = {
|
|
10967
|
-
name: '
|
|
11211
|
+
name: 'assertion',
|
|
10968
11212
|
functions: assertNormalExpression,
|
|
10969
11213
|
};
|
|
10970
11214
|
|
|
10971
11215
|
const moduleDocs$5 = {
|
|
10972
|
-
'every?': {
|
|
11216
|
+
'cell-every?': {
|
|
10973
11217
|
category: 'grid',
|
|
10974
11218
|
description: 'Checks if all elements in a grid satisfy a predicate. Returns true only if the predicate returns true for every element in the grid.',
|
|
10975
11219
|
returns: {
|
|
@@ -10992,9 +11236,9 @@ const moduleDocs$5 = {
|
|
|
10992
11236
|
},
|
|
10993
11237
|
],
|
|
10994
11238
|
examples: [
|
|
10995
|
-
'
|
|
10996
|
-
'
|
|
10997
|
-
'
|
|
11239
|
+
'let { cell-every? } = import(grid);\ncell-every?([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], string?)',
|
|
11240
|
+
'let { cell-every? } = import(grid);\ncell-every?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], string?)',
|
|
11241
|
+
'let { cell-every? } = import(grid);\ncell-every?([\n [1, 2],\n [3, 4],\n], string?)',
|
|
10998
11242
|
],
|
|
10999
11243
|
seeAlso: ['collection.every?', 'grid.some?', 'grid.every-row?', 'grid.every-col?'],
|
|
11000
11244
|
},
|
|
@@ -11025,7 +11269,7 @@ const moduleDocs$5 = {
|
|
|
11025
11269
|
'let { some? } = import(grid);\nsome?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], string?)',
|
|
11026
11270
|
'let { some? } = import(grid);\nsome?([\n [1, 2],\n [3, 4],\n], string?)',
|
|
11027
11271
|
],
|
|
11028
|
-
seeAlso: ['collection.any?', 'grid.every?', 'grid.some-row?', 'grid.some-col?'],
|
|
11272
|
+
seeAlso: ['collection.any?', 'grid.cell-every?', 'grid.some-row?', 'grid.some-col?'],
|
|
11029
11273
|
},
|
|
11030
11274
|
'every-row?': {
|
|
11031
11275
|
category: 'grid',
|
|
@@ -11054,7 +11298,7 @@ const moduleDocs$5 = {
|
|
|
11054
11298
|
'let { every-row? } = import(grid);\nevery-row?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], -> string?($[0]))',
|
|
11055
11299
|
'let { every-row? } = import(grid);\nevery-row?([\n [1, 2],\n [3, 4],\n], -> string?($[0]))',
|
|
11056
11300
|
],
|
|
11057
|
-
seeAlso: ['grid.some-row?', 'grid.every-col?', 'grid.every?'],
|
|
11301
|
+
seeAlso: ['grid.some-row?', 'grid.every-col?', 'grid.cell-every?'],
|
|
11058
11302
|
},
|
|
11059
11303
|
'some-row?': {
|
|
11060
11304
|
category: 'grid',
|
|
@@ -11112,7 +11356,7 @@ const moduleDocs$5 = {
|
|
|
11112
11356
|
'let { every-col? } = import(grid);\nevery-col?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], -> string?($[0]))',
|
|
11113
11357
|
'let { every-col? } = import(grid);\nevery-col?([\n [1, 2],\n [3, 4],\n], -> string?($[0]))',
|
|
11114
11358
|
],
|
|
11115
|
-
seeAlso: ['grid.some-col?', 'grid.every-row?', 'grid.every?'],
|
|
11359
|
+
seeAlso: ['grid.some-col?', 'grid.every-row?', 'grid.cell-every?'],
|
|
11116
11360
|
},
|
|
11117
11361
|
'some-col?': {
|
|
11118
11362
|
category: 'grid',
|
|
@@ -11260,7 +11504,7 @@ const moduleDocs$5 = {
|
|
|
11260
11504
|
'let { fill } = import(grid);\nfill(2, 3, 0)',
|
|
11261
11505
|
'let { fill } = import(grid);\nfill(2, 3, "x")',
|
|
11262
11506
|
],
|
|
11263
|
-
seeAlso: ['grid.generate', 'grid.from-array'
|
|
11507
|
+
seeAlso: ['grid.generate', 'grid.from-array'],
|
|
11264
11508
|
},
|
|
11265
11509
|
'generate': {
|
|
11266
11510
|
category: 'grid',
|
|
@@ -11294,7 +11538,7 @@ const moduleDocs$5 = {
|
|
|
11294
11538
|
examples: [
|
|
11295
11539
|
'let { generate } = import(grid);\ngenerate(3, 3, (i, j) -> i + j)',
|
|
11296
11540
|
],
|
|
11297
|
-
seeAlso: ['grid.fill', 'grid.from-array'
|
|
11541
|
+
seeAlso: ['grid.fill', 'grid.from-array'],
|
|
11298
11542
|
},
|
|
11299
11543
|
'reshape': {
|
|
11300
11544
|
category: 'grid',
|
|
@@ -11373,7 +11617,7 @@ const moduleDocs$5 = {
|
|
|
11373
11617
|
'let { flip-h } = import(grid);\nflip-h([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n])',
|
|
11374
11618
|
'let { flip-h } = import(grid);\nflip-h([\n [1, 2],\n [3, 4],\n])',
|
|
11375
11619
|
],
|
|
11376
|
-
seeAlso: ['grid.flip-v', 'grid.transpose', 'grid.rotate'
|
|
11620
|
+
seeAlso: ['grid.flip-v', 'grid.transpose', 'grid.rotate'],
|
|
11377
11621
|
},
|
|
11378
11622
|
'flip-v': {
|
|
11379
11623
|
category: 'grid',
|
|
@@ -11399,7 +11643,7 @@ const moduleDocs$5 = {
|
|
|
11399
11643
|
'let { flip-v } = import(grid);\nflip-v([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n])',
|
|
11400
11644
|
'let { flip-v } = import(grid);\nflip-v([\n [1, 2],\n [3, 4],\n])',
|
|
11401
11645
|
],
|
|
11402
|
-
seeAlso: ['grid.flip-h', 'grid.transpose', 'grid.rotate'
|
|
11646
|
+
seeAlso: ['grid.flip-h', 'grid.transpose', 'grid.rotate'],
|
|
11403
11647
|
},
|
|
11404
11648
|
'rotate': {
|
|
11405
11649
|
category: 'grid',
|
|
@@ -11434,61 +11678,9 @@ const moduleDocs$5 = {
|
|
|
11434
11678
|
],
|
|
11435
11679
|
seeAlso: ['grid.transpose', 'grid.flip-h', 'grid.flip-v'],
|
|
11436
11680
|
},
|
|
11437
|
-
'
|
|
11438
|
-
category: 'grid',
|
|
11439
|
-
description: 'Reverses the order of rows in the grid `g`.',
|
|
11440
|
-
returns: {
|
|
11441
|
-
type: 'grid',
|
|
11442
|
-
},
|
|
11443
|
-
args: {
|
|
11444
|
-
g: {
|
|
11445
|
-
type: 'grid',
|
|
11446
|
-
description: 'The grid to reverse rows.',
|
|
11447
|
-
},
|
|
11448
|
-
},
|
|
11449
|
-
variants: [
|
|
11450
|
-
{
|
|
11451
|
-
argumentNames: [
|
|
11452
|
-
'g',
|
|
11453
|
-
],
|
|
11454
|
-
},
|
|
11455
|
-
],
|
|
11456
|
-
examples: [
|
|
11457
|
-
'let { reverse-rows } = import(grid);\nreverse-rows([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n])',
|
|
11458
|
-
'let { reverse-rows } = import(grid);\nreverse-rows([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n])',
|
|
11459
|
-
'let { reverse-rows } = import(grid);\nreverse-rows([\n [1, 2],\n [3, 4],\n])',
|
|
11460
|
-
],
|
|
11461
|
-
seeAlso: ['grid.reverse-cols', 'grid.flip-v'],
|
|
11462
|
-
},
|
|
11463
|
-
'reverse-cols': {
|
|
11464
|
-
category: 'grid',
|
|
11465
|
-
description: 'Reverses the order of columns in the grid `g`.',
|
|
11466
|
-
returns: {
|
|
11467
|
-
type: 'grid',
|
|
11468
|
-
},
|
|
11469
|
-
args: {
|
|
11470
|
-
g: {
|
|
11471
|
-
type: 'grid',
|
|
11472
|
-
description: 'The grid to reverse columns.',
|
|
11473
|
-
},
|
|
11474
|
-
},
|
|
11475
|
-
variants: [
|
|
11476
|
-
{
|
|
11477
|
-
argumentNames: [
|
|
11478
|
-
'g',
|
|
11479
|
-
],
|
|
11480
|
-
},
|
|
11481
|
-
],
|
|
11482
|
-
examples: [
|
|
11483
|
-
'let { reverse-cols } = import(grid);\nreverse-cols([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n])',
|
|
11484
|
-
'let { reverse-cols } = import(grid);\nreverse-cols([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n])',
|
|
11485
|
-
'let { reverse-cols } = import(grid);\nreverse-cols([\n [1, 2],\n [3, 4],\n])',
|
|
11486
|
-
],
|
|
11487
|
-
seeAlso: ['grid.reverse-rows', 'grid.flip-h'],
|
|
11488
|
-
},
|
|
11489
|
-
'slice': {
|
|
11681
|
+
'crop': {
|
|
11490
11682
|
category: 'grid',
|
|
11491
|
-
description: '
|
|
11683
|
+
description: 'Crops the grid `g` from the starting index `begin` to the optional ending index `stop`. The crop is inclusive of the starting index and exclusive of the ending index.',
|
|
11492
11684
|
returns: {
|
|
11493
11685
|
type: 'grid',
|
|
11494
11686
|
},
|
|
@@ -11522,8 +11714,8 @@ const moduleDocs$5 = {
|
|
|
11522
11714
|
},
|
|
11523
11715
|
],
|
|
11524
11716
|
examples: [
|
|
11525
|
-
'
|
|
11526
|
-
'
|
|
11717
|
+
'let { crop } = import(grid);\ncrop([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], [1, 1], [2, 2])',
|
|
11718
|
+
'let { crop } = import(grid);\ncrop([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], [1, 1])',
|
|
11527
11719
|
],
|
|
11528
11720
|
hideOperatorForm: true,
|
|
11529
11721
|
seeAlso: ['grid.slice-rows', 'grid.slice-cols'],
|
|
@@ -11568,7 +11760,7 @@ const moduleDocs$5 = {
|
|
|
11568
11760
|
'let { slice-rows } = import(grid);\nslice-rows([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1)',
|
|
11569
11761
|
],
|
|
11570
11762
|
hideOperatorForm: true,
|
|
11571
|
-
seeAlso: ['grid.
|
|
11763
|
+
seeAlso: ['grid.crop', 'grid.slice-cols', 'grid.splice-rows'],
|
|
11572
11764
|
},
|
|
11573
11765
|
'slice-cols': {
|
|
11574
11766
|
category: 'grid',
|
|
@@ -11610,7 +11802,7 @@ const moduleDocs$5 = {
|
|
|
11610
11802
|
'let { slice-cols } = import(grid);\nslice-cols([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1)',
|
|
11611
11803
|
],
|
|
11612
11804
|
hideOperatorForm: true,
|
|
11613
|
-
seeAlso: ['grid.
|
|
11805
|
+
seeAlso: ['grid.crop', 'grid.slice-rows', 'grid.splice-cols'],
|
|
11614
11806
|
},
|
|
11615
11807
|
'splice-rows': {
|
|
11616
11808
|
category: 'grid',
|
|
@@ -11764,7 +11956,7 @@ const moduleDocs$5 = {
|
|
|
11764
11956
|
],
|
|
11765
11957
|
seeAlso: ['grid.concat-rows', 'grid.push-cols'],
|
|
11766
11958
|
},
|
|
11767
|
-
'map': {
|
|
11959
|
+
'cell-map': {
|
|
11768
11960
|
category: 'grid',
|
|
11769
11961
|
description: 'Maps a function `a` over each element of the grid `b`, returning a new grid with the results.',
|
|
11770
11962
|
returns: {
|
|
@@ -11787,11 +11979,11 @@ const moduleDocs$5 = {
|
|
|
11787
11979
|
},
|
|
11788
11980
|
],
|
|
11789
11981
|
examples: [
|
|
11790
|
-
'
|
|
11982
|
+
'let { cell-map } = import(grid);\ncell-map([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], str)',
|
|
11791
11983
|
],
|
|
11792
|
-
seeAlso: ['map', 'grid.mapi', 'grid.reduce'],
|
|
11984
|
+
seeAlso: ['map', 'grid.cell-mapi', 'grid.cell-reduce'],
|
|
11793
11985
|
},
|
|
11794
|
-
'mapi': {
|
|
11986
|
+
'cell-mapi': {
|
|
11795
11987
|
category: 'grid',
|
|
11796
11988
|
description: 'Maps a function `a` over each element of the grid `b`, passing the row and column index as additional arguments to the function.',
|
|
11797
11989
|
returns: {
|
|
@@ -11814,11 +12006,11 @@ const moduleDocs$5 = {
|
|
|
11814
12006
|
},
|
|
11815
12007
|
],
|
|
11816
12008
|
examples: [
|
|
11817
|
-
'
|
|
12009
|
+
'let { cell-mapi } = import(grid);\ncell-mapi([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], -> $1 ++ "(" ++ $2 ++ ", " ++ $3 ++ ")")',
|
|
11818
12010
|
],
|
|
11819
|
-
seeAlso: ['grid.map', 'grid.reducei', 'map'],
|
|
12011
|
+
seeAlso: ['grid.cell-map', 'grid.cell-reducei', 'map'],
|
|
11820
12012
|
},
|
|
11821
|
-
'reduce': {
|
|
12013
|
+
'cell-reduce': {
|
|
11822
12014
|
category: 'grid',
|
|
11823
12015
|
description: 'Reduces the grid `a` using the function `b`, returning a single value.',
|
|
11824
12016
|
returns: {
|
|
@@ -11848,11 +12040,11 @@ const moduleDocs$5 = {
|
|
|
11848
12040
|
},
|
|
11849
12041
|
],
|
|
11850
12042
|
examples: [
|
|
11851
|
-
'// Using "as" alias because "reduce" shadows a builtin function\nlet {
|
|
12043
|
+
'// Using "as" alias because "reduce" shadows a builtin function\nlet { cell-reduce } = import(grid);\ncell-reduce([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], ++, "")',
|
|
11852
12044
|
],
|
|
11853
|
-
seeAlso: ['reduce', 'grid.reducei', 'grid.map'],
|
|
12045
|
+
seeAlso: ['reduce', 'grid.cell-reducei', 'grid.cell-map'],
|
|
11854
12046
|
},
|
|
11855
|
-
'reducei': {
|
|
12047
|
+
'cell-reducei': {
|
|
11856
12048
|
category: 'grid',
|
|
11857
12049
|
description: 'Reduces the grid `a` using the function `b`, passing the row and column indices as additional arguments to the function.',
|
|
11858
12050
|
returns: {
|
|
@@ -11882,9 +12074,9 @@ const moduleDocs$5 = {
|
|
|
11882
12074
|
},
|
|
11883
12075
|
],
|
|
11884
12076
|
examples: [
|
|
11885
|
-
'// Using "as" alias because "reducei" shadows a builtin function\nlet {
|
|
12077
|
+
'// Using "as" alias because "reducei" shadows a builtin function\nlet { cell-reducei } = import(grid);\ncell-reducei([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], ++, "")',
|
|
11886
12078
|
],
|
|
11887
|
-
seeAlso: ['grid.reduce', 'grid.mapi', 'reduce'],
|
|
12079
|
+
seeAlso: ['grid.cell-reduce', 'grid.cell-mapi', 'reduce'],
|
|
11888
12080
|
},
|
|
11889
12081
|
'push-rows': {
|
|
11890
12082
|
category: 'grid',
|
|
@@ -12169,7 +12361,7 @@ function transpose(grid) {
|
|
|
12169
12361
|
}
|
|
12170
12362
|
|
|
12171
12363
|
const gridFunctions = {
|
|
12172
|
-
'every?': {
|
|
12364
|
+
'cell-every?': {
|
|
12173
12365
|
evaluate: ([grid, predicate], sourceCodeInfo, contextStack, { executeFunction }) => {
|
|
12174
12366
|
assertGrid(grid, sourceCodeInfo);
|
|
12175
12367
|
assertFunctionLike(predicate, sourceCodeInfo);
|
|
@@ -12372,21 +12564,7 @@ const gridFunctions = {
|
|
|
12372
12564
|
},
|
|
12373
12565
|
arity: toFixedArity(2),
|
|
12374
12566
|
},
|
|
12375
|
-
'
|
|
12376
|
-
evaluate: ([grid], sourceCodeInfo) => {
|
|
12377
|
-
assertGrid(grid, sourceCodeInfo);
|
|
12378
|
-
return grid.reverse();
|
|
12379
|
-
},
|
|
12380
|
-
arity: toFixedArity(1),
|
|
12381
|
-
},
|
|
12382
|
-
'reverse-cols': {
|
|
12383
|
-
evaluate: ([grid], sourceCodeInfo) => {
|
|
12384
|
-
assertGrid(grid, sourceCodeInfo);
|
|
12385
|
-
return grid.map(row => row.reverse());
|
|
12386
|
-
},
|
|
12387
|
-
arity: toFixedArity(1),
|
|
12388
|
-
},
|
|
12389
|
-
'slice': {
|
|
12567
|
+
'crop': {
|
|
12390
12568
|
evaluate: ([grid, start, end], sourceCodeInfo) => {
|
|
12391
12569
|
assertGrid(grid, sourceCodeInfo);
|
|
12392
12570
|
assertVector(start, sourceCodeInfo);
|
|
@@ -12554,7 +12732,7 @@ const gridFunctions = {
|
|
|
12554
12732
|
},
|
|
12555
12733
|
arity: { min: 1 },
|
|
12556
12734
|
},
|
|
12557
|
-
'map': {
|
|
12735
|
+
'cell-map': {
|
|
12558
12736
|
evaluate: (params, sourceCodeInfo, contextStack, { executeFunction }) => {
|
|
12559
12737
|
const fn = asFunctionLike(params.at(-1), sourceCodeInfo);
|
|
12560
12738
|
const grids = params.slice(0, -1);
|
|
@@ -12579,7 +12757,7 @@ const gridFunctions = {
|
|
|
12579
12757
|
},
|
|
12580
12758
|
arity: { min: 2 },
|
|
12581
12759
|
},
|
|
12582
|
-
'mapi': {
|
|
12760
|
+
'cell-mapi': {
|
|
12583
12761
|
evaluate: ([grid, fn], sourceCodeInfo, contextStack, { executeFunction }) => {
|
|
12584
12762
|
assertGrid(grid, sourceCodeInfo);
|
|
12585
12763
|
assertFunctionLike(fn, sourceCodeInfo);
|
|
@@ -12593,7 +12771,7 @@ const gridFunctions = {
|
|
|
12593
12771
|
},
|
|
12594
12772
|
arity: toFixedArity(2),
|
|
12595
12773
|
},
|
|
12596
|
-
'reduce': {
|
|
12774
|
+
'cell-reduce': {
|
|
12597
12775
|
evaluate: ([grid, fn, initialValue], sourceCodeInfo, contextStack, { executeFunction }) => {
|
|
12598
12776
|
assertGrid(grid, sourceCodeInfo);
|
|
12599
12777
|
assertFunctionLike(fn, sourceCodeInfo);
|
|
@@ -12607,7 +12785,7 @@ const gridFunctions = {
|
|
|
12607
12785
|
},
|
|
12608
12786
|
arity: toFixedArity(3),
|
|
12609
12787
|
},
|
|
12610
|
-
'reducei': {
|
|
12788
|
+
'cell-reducei': {
|
|
12611
12789
|
evaluate: ([grid, fn, initialValue], sourceCodeInfo, contextStack, { executeFunction }) => {
|
|
12612
12790
|
assertGrid(grid, sourceCodeInfo);
|
|
12613
12791
|
assertFunctionLike(fn, sourceCodeInfo);
|
|
@@ -12761,7 +12939,8 @@ const moduleDocs$4 = {
|
|
|
12761
12939
|
},
|
|
12762
12940
|
],
|
|
12763
12941
|
examples: [
|
|
12764
|
-
|
|
12942
|
+
`let { random! } = import(random);
|
|
12943
|
+
random!()`,
|
|
12765
12944
|
],
|
|
12766
12945
|
seeAlso: ['random.random-float!', 'random.random-int!', 'random.random-boolean!'],
|
|
12767
12946
|
},
|
|
@@ -12790,8 +12969,10 @@ const moduleDocs$4 = {
|
|
|
12790
12969
|
},
|
|
12791
12970
|
],
|
|
12792
12971
|
examples: [
|
|
12793
|
-
|
|
12794
|
-
|
|
12972
|
+
`let { random-int! } = import(random);
|
|
12973
|
+
random-int!(0, 10)`,
|
|
12974
|
+
`let { random-int! } = import(random);
|
|
12975
|
+
random-int!(1, 100)`,
|
|
12795
12976
|
],
|
|
12796
12977
|
seeAlso: ['random.random-int-inclusive!', 'random.random-float!', 'random.random!'],
|
|
12797
12978
|
},
|
|
@@ -12820,7 +13001,8 @@ const moduleDocs$4 = {
|
|
|
12820
13001
|
},
|
|
12821
13002
|
],
|
|
12822
13003
|
examples: [
|
|
12823
|
-
|
|
13004
|
+
`let { random-int-inclusive! } = import(random);
|
|
13005
|
+
random-int-inclusive!(0, 10)`,
|
|
12824
13006
|
],
|
|
12825
13007
|
seeAlso: ['random.random-int!', 'random.random-float!'],
|
|
12826
13008
|
},
|
|
@@ -12849,8 +13031,10 @@ const moduleDocs$4 = {
|
|
|
12849
13031
|
},
|
|
12850
13032
|
],
|
|
12851
13033
|
examples: [
|
|
12852
|
-
|
|
12853
|
-
|
|
13034
|
+
`let { random-float! } = import(random);
|
|
13035
|
+
random-float!(0, 10)`,
|
|
13036
|
+
`let { random-float! } = import(random);
|
|
13037
|
+
random-float!(1, 100)`,
|
|
12854
13038
|
],
|
|
12855
13039
|
seeAlso: ['random.random!', 'random.random-int!', 'random.random-int-inclusive!'],
|
|
12856
13040
|
},
|
|
@@ -12874,8 +13058,10 @@ const moduleDocs$4 = {
|
|
|
12874
13058
|
},
|
|
12875
13059
|
],
|
|
12876
13060
|
examples: [
|
|
12877
|
-
|
|
12878
|
-
|
|
13061
|
+
`let { random-boolean! } = import(random);
|
|
13062
|
+
random-boolean!()`,
|
|
13063
|
+
`let { random-boolean! } = import(random);
|
|
13064
|
+
random-boolean!(0.99)`,
|
|
12879
13065
|
],
|
|
12880
13066
|
seeAlso: ['random.random!'],
|
|
12881
13067
|
},
|
|
@@ -12899,8 +13085,10 @@ const moduleDocs$4 = {
|
|
|
12899
13085
|
},
|
|
12900
13086
|
],
|
|
12901
13087
|
examples: [
|
|
12902
|
-
|
|
12903
|
-
|
|
13088
|
+
`let { random-item! } = import(random);
|
|
13089
|
+
random-item!([1, 2, 3, 4, 5])`,
|
|
13090
|
+
`let { random-item! } = import(random);
|
|
13091
|
+
random-item!(["apple", "banana", "cherry"])`,
|
|
12904
13092
|
],
|
|
12905
13093
|
seeAlso: ['random.random-sample!', 'random.random-sample-unique!', 'random.random-char!'],
|
|
12906
13094
|
},
|
|
@@ -12929,8 +13117,10 @@ const moduleDocs$4 = {
|
|
|
12929
13117
|
},
|
|
12930
13118
|
],
|
|
12931
13119
|
examples: [
|
|
12932
|
-
|
|
12933
|
-
|
|
13120
|
+
`let { random-sample-unique! } = import(random);
|
|
13121
|
+
random-sample-unique!([1, 2, 3, 4, 5], 3)`,
|
|
13122
|
+
`let { random-sample-unique! } = import(random);
|
|
13123
|
+
random-sample-unique!(["apple", "banana", "cherry"], 2)`,
|
|
12934
13124
|
],
|
|
12935
13125
|
seeAlso: ['random.random-sample!', 'random.random-item!', 'random.shuffle!'],
|
|
12936
13126
|
},
|
|
@@ -12959,8 +13149,10 @@ const moduleDocs$4 = {
|
|
|
12959
13149
|
},
|
|
12960
13150
|
],
|
|
12961
13151
|
examples: [
|
|
12962
|
-
|
|
12963
|
-
|
|
13152
|
+
`let { random-sample! } = import(random);
|
|
13153
|
+
random-sample!([1, 2, 3, 4, 5], 3)`,
|
|
13154
|
+
`let { random-sample! } = import(random);
|
|
13155
|
+
random-sample!(["apple", "banana", "cherry"], 10)`,
|
|
12964
13156
|
],
|
|
12965
13157
|
seeAlso: ['random.random-sample-unique!', 'random.random-item!', 'random.shuffle!'],
|
|
12966
13158
|
},
|
|
@@ -12984,8 +13176,10 @@ const moduleDocs$4 = {
|
|
|
12984
13176
|
},
|
|
12985
13177
|
],
|
|
12986
13178
|
examples: [
|
|
12987
|
-
|
|
12988
|
-
|
|
13179
|
+
`let { shuffle! } = import(random);
|
|
13180
|
+
shuffle!([1, 2, 3, 4, 5])`,
|
|
13181
|
+
`let { shuffle! } = import(random);
|
|
13182
|
+
shuffle!(["apple", "banana", "cherry"])`,
|
|
12989
13183
|
],
|
|
12990
13184
|
seeAlso: ['random.random-sample!', 'random.random-sample-unique!'],
|
|
12991
13185
|
},
|
|
@@ -13014,8 +13208,10 @@ const moduleDocs$4 = {
|
|
|
13014
13208
|
},
|
|
13015
13209
|
],
|
|
13016
13210
|
examples: [
|
|
13017
|
-
|
|
13018
|
-
|
|
13211
|
+
`let { random-normal! } = import(random);
|
|
13212
|
+
random-normal!(0, 1)`,
|
|
13213
|
+
`let { random-normal! } = import(random);
|
|
13214
|
+
random-normal!(5, 2)`,
|
|
13019
13215
|
],
|
|
13020
13216
|
seeAlso: ['random.random-exponential!', 'random.random-binomial!', 'random.random-poisson!'],
|
|
13021
13217
|
hideOperatorForm: true,
|
|
@@ -13040,8 +13236,10 @@ const moduleDocs$4 = {
|
|
|
13040
13236
|
},
|
|
13041
13237
|
],
|
|
13042
13238
|
examples: [
|
|
13043
|
-
|
|
13044
|
-
|
|
13239
|
+
`let { random-exponential! } = import(random);
|
|
13240
|
+
random-exponential!(1)`,
|
|
13241
|
+
`let { random-exponential! } = import(random);
|
|
13242
|
+
random-exponential!(0.5)`,
|
|
13045
13243
|
],
|
|
13046
13244
|
seeAlso: ['random.random-normal!', 'random.random-poisson!', 'random.random-gamma!', 'random.random-pareto!'],
|
|
13047
13245
|
},
|
|
@@ -13070,8 +13268,10 @@ const moduleDocs$4 = {
|
|
|
13070
13268
|
},
|
|
13071
13269
|
],
|
|
13072
13270
|
examples: [
|
|
13073
|
-
|
|
13074
|
-
|
|
13271
|
+
`let { random-binomial! } = import(random);
|
|
13272
|
+
random-binomial!(10, 0.5)`,
|
|
13273
|
+
`let { random-binomial! } = import(random);
|
|
13274
|
+
random-binomial!(20, 0.3)`,
|
|
13075
13275
|
],
|
|
13076
13276
|
seeAlso: ['random.random-normal!', 'random.random-poisson!'],
|
|
13077
13277
|
hideOperatorForm: true,
|
|
@@ -13096,8 +13296,10 @@ const moduleDocs$4 = {
|
|
|
13096
13296
|
},
|
|
13097
13297
|
],
|
|
13098
13298
|
examples: [
|
|
13099
|
-
|
|
13100
|
-
|
|
13299
|
+
`let { random-poisson! } = import(random);
|
|
13300
|
+
random-poisson!(1)`,
|
|
13301
|
+
`let { random-poisson! } = import(random);
|
|
13302
|
+
random-poisson!(5)`,
|
|
13101
13303
|
],
|
|
13102
13304
|
seeAlso: ['random.random-binomial!', 'random.random-normal!', 'random.random-exponential!'],
|
|
13103
13305
|
},
|
|
@@ -13126,8 +13328,10 @@ const moduleDocs$4 = {
|
|
|
13126
13328
|
},
|
|
13127
13329
|
],
|
|
13128
13330
|
examples: [
|
|
13129
|
-
|
|
13130
|
-
|
|
13331
|
+
`let { random-gamma! } = import(random);
|
|
13332
|
+
random-gamma!(2, 2)`,
|
|
13333
|
+
`let { random-gamma! } = import(random);
|
|
13334
|
+
random-gamma!(5, 1)`,
|
|
13131
13335
|
],
|
|
13132
13336
|
seeAlso: ['random.random-exponential!', 'random.random-pareto!'],
|
|
13133
13337
|
hideOperatorForm: true,
|
|
@@ -13152,8 +13356,10 @@ const moduleDocs$4 = {
|
|
|
13152
13356
|
},
|
|
13153
13357
|
],
|
|
13154
13358
|
examples: [
|
|
13155
|
-
|
|
13156
|
-
|
|
13359
|
+
`let { random-pareto! } = import(random);
|
|
13360
|
+
random-pareto!(1)`,
|
|
13361
|
+
`let { random-pareto! } = import(random);
|
|
13362
|
+
random-pareto!(2)`,
|
|
13157
13363
|
],
|
|
13158
13364
|
seeAlso: ['random.random-gamma!', 'random.random-exponential!'],
|
|
13159
13365
|
},
|
|
@@ -13170,7 +13376,8 @@ const moduleDocs$4 = {
|
|
|
13170
13376
|
},
|
|
13171
13377
|
],
|
|
13172
13378
|
examples: [
|
|
13173
|
-
|
|
13379
|
+
`let { uuid! } = import(random);
|
|
13380
|
+
uuid!()`,
|
|
13174
13381
|
],
|
|
13175
13382
|
seeAlso: ['random.random-id!', 'random.random-string!'],
|
|
13176
13383
|
},
|
|
@@ -13194,8 +13401,10 @@ const moduleDocs$4 = {
|
|
|
13194
13401
|
},
|
|
13195
13402
|
],
|
|
13196
13403
|
examples: [
|
|
13197
|
-
|
|
13198
|
-
|
|
13404
|
+
`let { random-char! } = import(random);
|
|
13405
|
+
random-char!("abcde")`,
|
|
13406
|
+
`let { random-char! } = import(random);
|
|
13407
|
+
random-char!("ABCDEFGHIJKLMNOPQRSTUVWXYZ")`,
|
|
13199
13408
|
],
|
|
13200
13409
|
seeAlso: ['random.random-string!', 'random.random-item!'],
|
|
13201
13410
|
},
|
|
@@ -13224,8 +13433,10 @@ const moduleDocs$4 = {
|
|
|
13224
13433
|
},
|
|
13225
13434
|
],
|
|
13226
13435
|
examples: [
|
|
13227
|
-
|
|
13228
|
-
|
|
13436
|
+
`let { random-string! } = import(random);
|
|
13437
|
+
random-string!(10, "abcde")`,
|
|
13438
|
+
`let { random-string! } = import(random);
|
|
13439
|
+
random-string!(5, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")`,
|
|
13229
13440
|
],
|
|
13230
13441
|
seeAlso: ['random.random-char!', 'random.random-id!', 'random.uuid!'],
|
|
13231
13442
|
hideOperatorForm: true,
|
|
@@ -13250,8 +13461,10 @@ const moduleDocs$4 = {
|
|
|
13250
13461
|
},
|
|
13251
13462
|
],
|
|
13252
13463
|
examples: [
|
|
13253
|
-
|
|
13254
|
-
|
|
13464
|
+
`let { random-id! } = import(random);
|
|
13465
|
+
random-id!(10)`,
|
|
13466
|
+
`let { random-id! } = import(random);
|
|
13467
|
+
random-id!(5)`,
|
|
13255
13468
|
],
|
|
13256
13469
|
seeAlso: ['random.random-string!', 'random.uuid!'],
|
|
13257
13470
|
},
|
|
@@ -13268,7 +13481,8 @@ const moduleDocs$4 = {
|
|
|
13268
13481
|
},
|
|
13269
13482
|
],
|
|
13270
13483
|
examples: [
|
|
13271
|
-
|
|
13484
|
+
`let { random-color! } = import(random);
|
|
13485
|
+
random-color!()`,
|
|
13272
13486
|
],
|
|
13273
13487
|
},
|
|
13274
13488
|
};
|
|
@@ -13566,31 +13780,6 @@ const randomModule = {
|
|
|
13566
13780
|
};
|
|
13567
13781
|
|
|
13568
13782
|
const moduleDocs$3 = {
|
|
13569
|
-
'mean': {
|
|
13570
|
-
category: 'vector',
|
|
13571
|
-
description: 'Returns the **mean** of all elements in the `vector`.',
|
|
13572
|
-
returns: {
|
|
13573
|
-
type: 'number',
|
|
13574
|
-
},
|
|
13575
|
-
args: {
|
|
13576
|
-
vector: {
|
|
13577
|
-
type: 'vector',
|
|
13578
|
-
description: 'The `vector` to calculate the **mean** of.',
|
|
13579
|
-
},
|
|
13580
|
-
},
|
|
13581
|
-
variants: [
|
|
13582
|
-
{
|
|
13583
|
-
argumentNames: [
|
|
13584
|
-
'vector',
|
|
13585
|
-
],
|
|
13586
|
-
},
|
|
13587
|
-
],
|
|
13588
|
-
examples: [
|
|
13589
|
-
'mean([1, 2, 3])',
|
|
13590
|
-
'mean([1, 2, -3])',
|
|
13591
|
-
],
|
|
13592
|
-
seeAlso: ['mean', 'vector.moving-mean', 'vector.centered-moving-mean', 'vector.running-mean', 'vector.geometric-mean', 'vector.harmonic-mean', 'vector.median', 'vector.mode', 'vector.sum', 'vector.rms'],
|
|
13593
|
-
},
|
|
13594
13783
|
'moving-mean': {
|
|
13595
13784
|
category: 'vector',
|
|
13596
13785
|
description: 'Returns the **moving mean** of the `vector` with a given window size.',
|
|
@@ -13625,7 +13814,7 @@ const moduleDocs$3 = {
|
|
|
13625
13814
|
'let { moving-mean } = import(vector);\nmoving-mean([1, 2, 3, 4, 5], 3)',
|
|
13626
13815
|
'let { moving-mean } = import(vector);\nmoving-mean([1, 2, 3, 4, 5], 5)',
|
|
13627
13816
|
],
|
|
13628
|
-
seeAlso: ['moving-fn', '
|
|
13817
|
+
seeAlso: ['moving-fn', 'mean', 'vector.centered-moving-mean', 'vector.running-mean'],
|
|
13629
13818
|
},
|
|
13630
13819
|
'centered-moving-mean': {
|
|
13631
13820
|
category: 'vector',
|
|
@@ -13685,7 +13874,7 @@ const moduleDocs$3 = {
|
|
|
13685
13874
|
'let { centered-moving-mean } = import(vector);\ncentered-moving-mean([1, 2, 3, 4, 5], 3, 0, 10)',
|
|
13686
13875
|
'let { centered-moving-mean } = import(vector);\ncentered-moving-mean([1, 2, 3, 4, 5], 3, 10)',
|
|
13687
13876
|
],
|
|
13688
|
-
seeAlso: ['
|
|
13877
|
+
seeAlso: ['mean', 'vector.moving-mean', 'vector.running-mean'],
|
|
13689
13878
|
},
|
|
13690
13879
|
'running-mean': {
|
|
13691
13880
|
category: 'vector',
|
|
@@ -13709,7 +13898,7 @@ const moduleDocs$3 = {
|
|
|
13709
13898
|
examples: [
|
|
13710
13899
|
'let { running-mean } = import(vector);\nrunning-mean([1, 2, 3, 4, 5])',
|
|
13711
13900
|
],
|
|
13712
|
-
seeAlso: ['running-fn', '
|
|
13901
|
+
seeAlso: ['running-fn', 'mean', 'vector.moving-mean', 'vector.centered-moving-mean'],
|
|
13713
13902
|
},
|
|
13714
13903
|
'geometric-mean': {
|
|
13715
13904
|
category: 'vector',
|
|
@@ -13734,7 +13923,7 @@ const moduleDocs$3 = {
|
|
|
13734
13923
|
'let { geometric-mean } = import(vector);\ngeometric-mean([1, 2, 3])',
|
|
13735
13924
|
'let { geometric-mean } = import(vector);\ngeometric-mean([1, 2, 9])',
|
|
13736
13925
|
],
|
|
13737
|
-
seeAlso: ['vector.moving-geometric-mean', 'vector.centered-moving-geometric-mean', 'vector.running-geometric-mean', '
|
|
13926
|
+
seeAlso: ['vector.moving-geometric-mean', 'vector.centered-moving-geometric-mean', 'vector.running-geometric-mean', 'mean', 'vector.harmonic-mean'],
|
|
13738
13927
|
},
|
|
13739
13928
|
'moving-geometric-mean': {
|
|
13740
13929
|
category: 'vector',
|
|
@@ -13879,7 +14068,7 @@ const moduleDocs$3 = {
|
|
|
13879
14068
|
'let { harmonic-mean } = import(vector);\nharmonic-mean([1, 2, 3])',
|
|
13880
14069
|
'let { harmonic-mean } = import(vector);\nharmonic-mean([1, 2, 9])',
|
|
13881
14070
|
],
|
|
13882
|
-
seeAlso: ['vector.moving-harmonic-mean', 'vector.centered-moving-harmonic-mean', 'vector.running-harmonic-mean', '
|
|
14071
|
+
seeAlso: ['vector.moving-harmonic-mean', 'vector.centered-moving-harmonic-mean', 'vector.running-harmonic-mean', 'mean', 'vector.geometric-mean'],
|
|
13883
14072
|
},
|
|
13884
14073
|
'moving-harmonic-mean': {
|
|
13885
14074
|
category: 'vector',
|
|
@@ -14001,33 +14190,6 @@ const moduleDocs$3 = {
|
|
|
14001
14190
|
],
|
|
14002
14191
|
seeAlso: ['vector.harmonic-mean', 'vector.moving-harmonic-mean', 'vector.centered-moving-harmonic-mean'],
|
|
14003
14192
|
},
|
|
14004
|
-
'median': {
|
|
14005
|
-
category: 'vector',
|
|
14006
|
-
description: 'Returns the median of all elements in the vector.',
|
|
14007
|
-
returns: {
|
|
14008
|
-
type: 'number',
|
|
14009
|
-
},
|
|
14010
|
-
args: {
|
|
14011
|
-
vector: {
|
|
14012
|
-
type: 'vector',
|
|
14013
|
-
description: 'The vector to calculate the median of.',
|
|
14014
|
-
},
|
|
14015
|
-
},
|
|
14016
|
-
variants: [
|
|
14017
|
-
{
|
|
14018
|
-
argumentNames: [
|
|
14019
|
-
'vector',
|
|
14020
|
-
],
|
|
14021
|
-
},
|
|
14022
|
-
],
|
|
14023
|
-
examples: [
|
|
14024
|
-
'median([1, 2, 3])',
|
|
14025
|
-
'median([1, 2, -3])',
|
|
14026
|
-
'median([1, 2, 3, 4])',
|
|
14027
|
-
'median([1, 2, -3, 4])',
|
|
14028
|
-
],
|
|
14029
|
-
seeAlso: ['median', 'vector.moving-median', 'vector.centered-moving-median', 'vector.running-median', 'vector.mean', 'vector.mode', 'vector.quartiles', 'vector.percentile', 'vector.iqr', 'vector.medad'],
|
|
14030
|
-
},
|
|
14031
14193
|
'moving-median': {
|
|
14032
14194
|
category: 'vector',
|
|
14033
14195
|
description: 'Returns the **moving median** of the `vector` with a given window size.',
|
|
@@ -14062,7 +14224,7 @@ const moduleDocs$3 = {
|
|
|
14062
14224
|
'let { moving-median } = import(vector);\nmoving-median([1, 2, 3, 4, 5], 3)',
|
|
14063
14225
|
'let { moving-median } = import(vector);\nmoving-median([1, 2, 3, 4, 5], 5)',
|
|
14064
14226
|
],
|
|
14065
|
-
seeAlso: ['
|
|
14227
|
+
seeAlso: ['median', 'vector.centered-moving-median', 'vector.running-median'],
|
|
14066
14228
|
},
|
|
14067
14229
|
'centered-moving-median': {
|
|
14068
14230
|
category: 'vector',
|
|
@@ -14122,7 +14284,7 @@ const moduleDocs$3 = {
|
|
|
14122
14284
|
'let { centered-moving-median } = import(vector);\ncentered-moving-median([1, 2, 3, 4, 5], 3, 0, 10)',
|
|
14123
14285
|
'let { centered-moving-median } = import(vector);\ncentered-moving-median([1, 2, 3, 4, 5], 3, 10)',
|
|
14124
14286
|
],
|
|
14125
|
-
seeAlso: ['
|
|
14287
|
+
seeAlso: ['median', 'vector.moving-median', 'vector.running-median'],
|
|
14126
14288
|
},
|
|
14127
14289
|
'running-median': {
|
|
14128
14290
|
category: 'vector',
|
|
@@ -14146,7 +14308,7 @@ const moduleDocs$3 = {
|
|
|
14146
14308
|
examples: [
|
|
14147
14309
|
'let { running-median } = import(vector);\nrunning-median([1, 2, 3, 4, 5])',
|
|
14148
14310
|
],
|
|
14149
|
-
seeAlso: ['
|
|
14311
|
+
seeAlso: ['median', 'vector.moving-median', 'vector.centered-moving-median'],
|
|
14150
14312
|
},
|
|
14151
14313
|
'variance': {
|
|
14152
14314
|
category: 'vector',
|
|
@@ -14764,10 +14926,10 @@ const moduleDocs$3 = {
|
|
|
14764
14926
|
'let { iqr } = import(vector);\niqr([1, 2, 3, 4])',
|
|
14765
14927
|
'let { iqr } = import(vector);\niqr([5, 4, 3, 2, 1, 2, 3, 4, 5])',
|
|
14766
14928
|
'let { iqr } = import(vector);\niqr(range(1, 1000))',
|
|
14767
|
-
'let { iqr
|
|
14768
|
-
'let { iqr
|
|
14929
|
+
'let { iqr } = import(vector);\niqr(map(range(1000), -> 1e6 / ($ + 1) ^ 2))',
|
|
14930
|
+
'let { iqr } = import(vector);\nlet { ln } = import(math);\niqr(map(range(1000), -> ln($ + 1)))',
|
|
14769
14931
|
],
|
|
14770
|
-
seeAlso: ['vector.moving-iqr', 'vector.centered-moving-iqr', 'vector.running-iqr', 'vector.quartiles', '
|
|
14932
|
+
seeAlso: ['vector.moving-iqr', 'vector.centered-moving-iqr', 'vector.running-iqr', 'vector.quartiles', 'median', 'vector.mad', 'vector.medad', 'vector.outliers?', 'vector.outliers'],
|
|
14771
14933
|
},
|
|
14772
14934
|
'moving-iqr': {
|
|
14773
14935
|
category: 'vector',
|
|
@@ -14890,31 +15052,6 @@ const moduleDocs$3 = {
|
|
|
14890
15052
|
],
|
|
14891
15053
|
seeAlso: ['vector.iqr', 'vector.moving-iqr', 'vector.centered-moving-iqr'],
|
|
14892
15054
|
},
|
|
14893
|
-
'sum': {
|
|
14894
|
-
category: 'vector',
|
|
14895
|
-
description: 'Returns the sum of all elements in the vector.',
|
|
14896
|
-
returns: {
|
|
14897
|
-
type: 'number',
|
|
14898
|
-
},
|
|
14899
|
-
args: {
|
|
14900
|
-
vector: {
|
|
14901
|
-
type: 'vector',
|
|
14902
|
-
description: 'The vector to sum.',
|
|
14903
|
-
},
|
|
14904
|
-
},
|
|
14905
|
-
variants: [
|
|
14906
|
-
{
|
|
14907
|
-
argumentNames: [
|
|
14908
|
-
'vector',
|
|
14909
|
-
],
|
|
14910
|
-
},
|
|
14911
|
-
],
|
|
14912
|
-
examples: [
|
|
14913
|
-
'sum([1, 2, 3])',
|
|
14914
|
-
'sum([1, 2, -3])',
|
|
14915
|
-
],
|
|
14916
|
-
seeAlso: ['sum', 'vector.moving-sum', 'vector.centered-moving-sum', 'vector.running-sum', 'vector.prod', 'vector.cumsum', 'vector.mean'],
|
|
14917
|
-
},
|
|
14918
15055
|
'moving-sum': {
|
|
14919
15056
|
category: 'vector',
|
|
14920
15057
|
description: 'Returns the **moving sum** of the `vector` with a given window size.',
|
|
@@ -14949,7 +15086,7 @@ const moduleDocs$3 = {
|
|
|
14949
15086
|
'let { moving-sum } = import(vector);\nmoving-sum([1, 2, 3, 4, 5], 3)',
|
|
14950
15087
|
'let { moving-sum } = import(vector);\nmoving-sum([1, 2, 3, 4, 5], 5)',
|
|
14951
15088
|
],
|
|
14952
|
-
seeAlso: ['
|
|
15089
|
+
seeAlso: ['sum', 'vector.centered-moving-sum', 'vector.running-sum'],
|
|
14953
15090
|
},
|
|
14954
15091
|
'centered-moving-sum': {
|
|
14955
15092
|
category: 'vector',
|
|
@@ -15009,7 +15146,7 @@ const moduleDocs$3 = {
|
|
|
15009
15146
|
'let { centered-moving-sum } = import(vector);\ncentered-moving-sum([1, 2, 3, 4, 5], 3, 0, 0)',
|
|
15010
15147
|
'let { centered-moving-sum } = import(vector);\ncentered-moving-sum([1, 2, 3, 4, 5], 3, 10)',
|
|
15011
15148
|
],
|
|
15012
|
-
seeAlso: ['
|
|
15149
|
+
seeAlso: ['sum', 'vector.moving-sum', 'vector.running-sum'],
|
|
15013
15150
|
},
|
|
15014
15151
|
'running-sum': {
|
|
15015
15152
|
category: 'vector',
|
|
@@ -15034,32 +15171,7 @@ const moduleDocs$3 = {
|
|
|
15034
15171
|
'let { running-sum } = import(vector);\nrunning-sum([1, 2, 3])',
|
|
15035
15172
|
'let { running-sum } = import(vector);\nrunning-sum([1, -2, -3])',
|
|
15036
15173
|
],
|
|
15037
|
-
seeAlso: ['
|
|
15038
|
-
},
|
|
15039
|
-
'prod': {
|
|
15040
|
-
category: 'vector',
|
|
15041
|
-
description: 'Returns the **product** of all elements in the `vector`.',
|
|
15042
|
-
returns: {
|
|
15043
|
-
type: 'number',
|
|
15044
|
-
},
|
|
15045
|
-
args: {
|
|
15046
|
-
vector: {
|
|
15047
|
-
type: 'vector',
|
|
15048
|
-
description: 'The `vector` to calculate the **product** of.',
|
|
15049
|
-
},
|
|
15050
|
-
},
|
|
15051
|
-
variants: [
|
|
15052
|
-
{
|
|
15053
|
-
argumentNames: [
|
|
15054
|
-
'vector',
|
|
15055
|
-
],
|
|
15056
|
-
},
|
|
15057
|
-
],
|
|
15058
|
-
examples: [
|
|
15059
|
-
'prod([1, 2, 3])',
|
|
15060
|
-
'prod([1, 2, -3])',
|
|
15061
|
-
],
|
|
15062
|
-
seeAlso: ['prod', 'vector.moving-prod', 'vector.centered-moving-prod', 'vector.running-prod', 'vector.sum', 'vector.cumprod'],
|
|
15174
|
+
seeAlso: ['sum', 'vector.moving-sum', 'vector.centered-moving-sum', 'vector.cumsum'],
|
|
15063
15175
|
},
|
|
15064
15176
|
'moving-prod': {
|
|
15065
15177
|
category: 'vector',
|
|
@@ -15095,7 +15207,7 @@ const moduleDocs$3 = {
|
|
|
15095
15207
|
'let { moving-prod } = import(vector);\nmoving-prod([1, 2, 3, 4, 5], 3)',
|
|
15096
15208
|
'let { moving-prod } = import(vector);\nmoving-prod([1, 2, 3, 4, 5], 5)',
|
|
15097
15209
|
],
|
|
15098
|
-
seeAlso: ['
|
|
15210
|
+
seeAlso: ['prod', 'vector.centered-moving-prod', 'vector.running-prod'],
|
|
15099
15211
|
},
|
|
15100
15212
|
'centered-moving-prod': {
|
|
15101
15213
|
category: 'vector',
|
|
@@ -15154,7 +15266,7 @@ const moduleDocs$3 = {
|
|
|
15154
15266
|
'let { centered-moving-prod } = import(vector);\ncentered-moving-prod([1, 2, 3, 4, 5], 3)',
|
|
15155
15267
|
'let { centered-moving-prod } = import(vector);\ncentered-moving-prod([1, 2, 3, 4, 5], 3, 0, 0)',
|
|
15156
15268
|
],
|
|
15157
|
-
seeAlso: ['
|
|
15269
|
+
seeAlso: ['prod', 'vector.moving-prod', 'vector.running-prod'],
|
|
15158
15270
|
},
|
|
15159
15271
|
'running-prod': {
|
|
15160
15272
|
category: 'vector',
|
|
@@ -15179,7 +15291,7 @@ const moduleDocs$3 = {
|
|
|
15179
15291
|
'let { running-prod } = import(vector);\nrunning-prod([1, 2, 3, 4, 5])',
|
|
15180
15292
|
'let { running-prod } = import(vector);\nrunning-prod([1, -2, -3])',
|
|
15181
15293
|
],
|
|
15182
|
-
seeAlso: ['
|
|
15294
|
+
seeAlso: ['prod', 'vector.moving-prod', 'vector.centered-moving-prod', 'vector.cumprod'],
|
|
15183
15295
|
},
|
|
15184
15296
|
'span': {
|
|
15185
15297
|
category: 'vector',
|
|
@@ -16214,10 +16326,10 @@ const moduleDocs$3 = {
|
|
|
16214
16326
|
'let { rms } = import(vector);\nrms([1, 2, 3, 4])',
|
|
16215
16327
|
'let { rms } = import(vector);\nrms([5, 4, 3, 2, 1])',
|
|
16216
16328
|
'let { rms } = import(vector);\nrms(range(1, 1000))',
|
|
16217
|
-
'let { rms
|
|
16218
|
-
'let { rms
|
|
16329
|
+
'let { rms } = import(vector);\nrms(map(range(1000), -> 1e6 / ($ + 1) ^ 2))',
|
|
16330
|
+
'let { rms } = import(vector);\nlet { ln } = import(math);\nrms(map(range(1000), -> ln($ + 1)))',
|
|
16219
16331
|
],
|
|
16220
|
-
seeAlso: ['vector.moving-rms', 'vector.centered-moving-rms', 'vector.running-rms', '
|
|
16332
|
+
seeAlso: ['vector.moving-rms', 'vector.centered-moving-rms', 'vector.running-rms', 'mean', 'vector.stdev'],
|
|
16221
16333
|
},
|
|
16222
16334
|
'moving-rms': {
|
|
16223
16335
|
category: 'vector',
|
|
@@ -16511,7 +16623,7 @@ const moduleDocs$3 = {
|
|
|
16511
16623
|
'let { medad } = import(vector);\nmedad([1, 2, 3])',
|
|
16512
16624
|
'let { medad } = import(vector);\nmedad([1, 2, -3])',
|
|
16513
16625
|
],
|
|
16514
|
-
seeAlso: ['vector.moving-medad', 'vector.centered-moving-medad', 'vector.running-medad', 'vector.mad', '
|
|
16626
|
+
seeAlso: ['vector.moving-medad', 'vector.centered-moving-medad', 'vector.running-medad', 'vector.mad', 'median', 'vector.iqr'],
|
|
16515
16627
|
},
|
|
16516
16628
|
'moving-medad': {
|
|
16517
16629
|
category: 'vector',
|
|
@@ -17135,7 +17247,7 @@ const moduleDocs$3 = {
|
|
|
17135
17247
|
'let { mode } = import(vector);\nmode([2, 2, 3, 3])',
|
|
17136
17248
|
'let { mode } = import(vector);\nmode([1, 2, 3, 2, 1, 2])',
|
|
17137
17249
|
],
|
|
17138
|
-
seeAlso: ['
|
|
17250
|
+
seeAlso: ['mean', 'median'],
|
|
17139
17251
|
},
|
|
17140
17252
|
'min-index': {
|
|
17141
17253
|
category: 'vector',
|
|
@@ -17285,165 +17397,6 @@ const moduleDocs$3 = {
|
|
|
17285
17397
|
],
|
|
17286
17398
|
seeAlso: [
|
|
17287
17399
|
'range',
|
|
17288
|
-
'vector.ones',
|
|
17289
|
-
'vector.zeros',
|
|
17290
|
-
'vector.fill',
|
|
17291
|
-
'vector.generate',
|
|
17292
|
-
],
|
|
17293
|
-
},
|
|
17294
|
-
'ones': {
|
|
17295
|
-
category: 'vector',
|
|
17296
|
-
description: 'Generates a vector of ones.',
|
|
17297
|
-
returns: {
|
|
17298
|
-
type: 'number',
|
|
17299
|
-
array: true,
|
|
17300
|
-
},
|
|
17301
|
-
args: {
|
|
17302
|
-
length: {
|
|
17303
|
-
type: 'integer',
|
|
17304
|
-
description: 'The length of the vector.',
|
|
17305
|
-
},
|
|
17306
|
-
},
|
|
17307
|
-
variants: [
|
|
17308
|
-
{
|
|
17309
|
-
argumentNames: [
|
|
17310
|
-
'length',
|
|
17311
|
-
],
|
|
17312
|
-
},
|
|
17313
|
-
],
|
|
17314
|
-
examples: [
|
|
17315
|
-
'let { ones } = import(vector);\nones(5)',
|
|
17316
|
-
'let { ones } = import(vector);\nones(10)',
|
|
17317
|
-
'let { ones } = import(vector);\nones(0)',
|
|
17318
|
-
],
|
|
17319
|
-
seeAlso: [
|
|
17320
|
-
'repeat',
|
|
17321
|
-
'vector.zeros',
|
|
17322
|
-
'vector.fill',
|
|
17323
|
-
'vector.generate',
|
|
17324
|
-
'vector.linspace',
|
|
17325
|
-
],
|
|
17326
|
-
},
|
|
17327
|
-
'zeros': {
|
|
17328
|
-
category: 'vector',
|
|
17329
|
-
description: 'Generates a vector of zeros.',
|
|
17330
|
-
returns: {
|
|
17331
|
-
type: 'number',
|
|
17332
|
-
array: true,
|
|
17333
|
-
},
|
|
17334
|
-
args: {
|
|
17335
|
-
length: {
|
|
17336
|
-
type: 'integer',
|
|
17337
|
-
description: 'The length of the vector.',
|
|
17338
|
-
},
|
|
17339
|
-
},
|
|
17340
|
-
variants: [
|
|
17341
|
-
{
|
|
17342
|
-
argumentNames: [
|
|
17343
|
-
'length',
|
|
17344
|
-
],
|
|
17345
|
-
},
|
|
17346
|
-
],
|
|
17347
|
-
examples: [
|
|
17348
|
-
'let { zeros } = import(vector);\nzeros(5)',
|
|
17349
|
-
'let { zeros } = import(vector);\nzeros(10)',
|
|
17350
|
-
'let { zeros } = import(vector);\nzeros(0)',
|
|
17351
|
-
],
|
|
17352
|
-
seeAlso: [
|
|
17353
|
-
'repeat',
|
|
17354
|
-
'vector.ones',
|
|
17355
|
-
'vector.fill',
|
|
17356
|
-
'vector.generate',
|
|
17357
|
-
'vector.linspace',
|
|
17358
|
-
],
|
|
17359
|
-
},
|
|
17360
|
-
'fill': {
|
|
17361
|
-
category: 'vector',
|
|
17362
|
-
description: 'Generates a vector filled with a number.',
|
|
17363
|
-
returns: {
|
|
17364
|
-
type: 'number',
|
|
17365
|
-
array: true,
|
|
17366
|
-
},
|
|
17367
|
-
args: {
|
|
17368
|
-
length: {
|
|
17369
|
-
type: 'integer',
|
|
17370
|
-
description: 'The length of the vector.',
|
|
17371
|
-
},
|
|
17372
|
-
value: {
|
|
17373
|
-
type: 'number',
|
|
17374
|
-
description: 'The value to fill the vector with.',
|
|
17375
|
-
},
|
|
17376
|
-
a: {
|
|
17377
|
-
type: 'number',
|
|
17378
|
-
},
|
|
17379
|
-
b: {
|
|
17380
|
-
type: 'integer',
|
|
17381
|
-
},
|
|
17382
|
-
},
|
|
17383
|
-
variants: [
|
|
17384
|
-
{
|
|
17385
|
-
argumentNames: [
|
|
17386
|
-
'length',
|
|
17387
|
-
'value',
|
|
17388
|
-
],
|
|
17389
|
-
},
|
|
17390
|
-
],
|
|
17391
|
-
examples: [
|
|
17392
|
-
'let { fill } = import(vector);\nfill(5, PI)',
|
|
17393
|
-
'let { fill } = import(vector);\nfill(10, -1)',
|
|
17394
|
-
],
|
|
17395
|
-
seeAlso: [
|
|
17396
|
-
'repeat',
|
|
17397
|
-
'vector.ones',
|
|
17398
|
-
'vector.zeros',
|
|
17399
|
-
'vector.generate',
|
|
17400
|
-
'vector.linspace',
|
|
17401
|
-
'grid.fill',
|
|
17402
|
-
],
|
|
17403
|
-
},
|
|
17404
|
-
'generate': {
|
|
17405
|
-
category: 'vector',
|
|
17406
|
-
description: 'Generates a vector of numbers based on a function.',
|
|
17407
|
-
returns: {
|
|
17408
|
-
type: 'number',
|
|
17409
|
-
array: true,
|
|
17410
|
-
},
|
|
17411
|
-
args: {
|
|
17412
|
-
length: {
|
|
17413
|
-
type: 'integer',
|
|
17414
|
-
description: 'The length of the vector.',
|
|
17415
|
-
},
|
|
17416
|
-
func: {
|
|
17417
|
-
type: 'function',
|
|
17418
|
-
description: 'A function that takes an index and returns a number.',
|
|
17419
|
-
},
|
|
17420
|
-
a: {
|
|
17421
|
-
type: 'number',
|
|
17422
|
-
},
|
|
17423
|
-
b: {
|
|
17424
|
-
type: 'integer',
|
|
17425
|
-
},
|
|
17426
|
-
},
|
|
17427
|
-
variants: [
|
|
17428
|
-
{
|
|
17429
|
-
argumentNames: [
|
|
17430
|
-
'length',
|
|
17431
|
-
'func',
|
|
17432
|
-
],
|
|
17433
|
-
},
|
|
17434
|
-
],
|
|
17435
|
-
examples: [
|
|
17436
|
-
'let { generate } = import(vector);\ngenerate(5, -> $ * 2)',
|
|
17437
|
-
'let { generate } = import(vector);\ngenerate(10, -> $ + 1)',
|
|
17438
|
-
'let { generate } = import(vector);\ngenerate(0, -> $ + 1)',
|
|
17439
|
-
],
|
|
17440
|
-
seeAlso: [
|
|
17441
|
-
'repeat',
|
|
17442
|
-
'vector.ones',
|
|
17443
|
-
'vector.zeros',
|
|
17444
|
-
'vector.fill',
|
|
17445
|
-
'vector.linspace',
|
|
17446
|
-
'grid.generate',
|
|
17447
17400
|
],
|
|
17448
17401
|
},
|
|
17449
17402
|
'cumsum': {
|
|
@@ -17471,7 +17424,7 @@ const moduleDocs$3 = {
|
|
|
17471
17424
|
'let { cumsum } = import(vector);\ncumsum([1, 2, -3])',
|
|
17472
17425
|
'let { cumsum } = import(vector);\ncumsum([])',
|
|
17473
17426
|
],
|
|
17474
|
-
seeAlso: ['vector.cumprod', '
|
|
17427
|
+
seeAlso: ['vector.cumprod', 'sum', 'vector.running-sum'],
|
|
17475
17428
|
},
|
|
17476
17429
|
'cumprod': {
|
|
17477
17430
|
category: 'vector',
|
|
@@ -17498,7 +17451,7 @@ const moduleDocs$3 = {
|
|
|
17498
17451
|
'let { cumprod } = import(vector);\ncumprod([1, 2, -3, 0, 10])',
|
|
17499
17452
|
'let { cumprod } = import(vector);\ncumprod([])',
|
|
17500
17453
|
],
|
|
17501
|
-
seeAlso: ['vector.cumsum', '
|
|
17454
|
+
seeAlso: ['vector.cumsum', 'prod', 'vector.running-prod'],
|
|
17502
17455
|
},
|
|
17503
17456
|
'quartiles': {
|
|
17504
17457
|
category: 'vector',
|
|
@@ -17524,10 +17477,10 @@ const moduleDocs$3 = {
|
|
|
17524
17477
|
'let { quartiles } = import(vector);\nquartiles([1, 2, 3, 4])',
|
|
17525
17478
|
'let { quartiles } = import(vector);\nquartiles([5, 4, 3, 2, 1, 2, 3, 4, 5])',
|
|
17526
17479
|
'let { quartiles } = import(vector);\nquartiles(range(1, 1000))',
|
|
17527
|
-
'let { quartiles
|
|
17528
|
-
'let { quartiles
|
|
17480
|
+
'let { quartiles } = import(vector);\nquartiles(map(range(1000), -> 1e6 / ($ + 1) ^ 2))',
|
|
17481
|
+
'let { quartiles } = import(vector);\nlet { ln } = import(math);\nquartiles(map(range(1000), -> ln($ + 1)))',
|
|
17529
17482
|
],
|
|
17530
|
-
seeAlso: ['vector.percentile', 'vector.quantile', '
|
|
17483
|
+
seeAlso: ['vector.percentile', 'vector.quantile', 'median', 'vector.iqr'],
|
|
17531
17484
|
},
|
|
17532
17485
|
'percentile': {
|
|
17533
17486
|
category: 'vector',
|
|
@@ -17573,7 +17526,7 @@ const moduleDocs$3 = {
|
|
|
17573
17526
|
'let { percentile } = import(vector);\npercentile(range(100) ^ 0.5, 90)',
|
|
17574
17527
|
'let { percentile } = import(vector);\npercentile(range(100) ^ 0.5, 100)',
|
|
17575
17528
|
],
|
|
17576
|
-
seeAlso: ['vector.quantile', 'vector.quartiles', '
|
|
17529
|
+
seeAlso: ['vector.quantile', 'vector.quartiles', 'median', 'vector.ecdf', 'vector.winsorize'],
|
|
17577
17530
|
},
|
|
17578
17531
|
'quantile': {
|
|
17579
17532
|
category: 'vector',
|
|
@@ -18488,6 +18441,12 @@ addReductionFunctions$1(madReductionFunction);
|
|
|
18488
18441
|
addReductionFunctions$1(medadReductionFunction);
|
|
18489
18442
|
addReductionFunctions$1(giniCoefficientReductionFunction);
|
|
18490
18443
|
addReductionFunctions$1(entropyReductionFunction);
|
|
18444
|
+
// Remove base variants that duplicate core built-ins (sum, prod, mean, median).
|
|
18445
|
+
// The moving/centered-moving/running variants are unique to the vector module.
|
|
18446
|
+
delete reductionFunctionNormalExpressions.sum;
|
|
18447
|
+
delete reductionFunctionNormalExpressions.prod;
|
|
18448
|
+
delete reductionFunctionNormalExpressions.mean;
|
|
18449
|
+
delete reductionFunctionNormalExpressions.median;
|
|
18491
18450
|
function addReductionFunctions$1(fns) {
|
|
18492
18451
|
for (const [key, value] of Object.entries(fns)) {
|
|
18493
18452
|
/* v8 ignore next 3 */
|
|
@@ -18728,40 +18687,6 @@ const vectorFunctions = {
|
|
|
18728
18687
|
},
|
|
18729
18688
|
arity: toFixedArity(3),
|
|
18730
18689
|
},
|
|
18731
|
-
'ones': {
|
|
18732
|
-
evaluate: ([length], sourceCodeInfo) => {
|
|
18733
|
-
assertNumber(length, sourceCodeInfo, { integer: true, nonNegative: true });
|
|
18734
|
-
return Array.from({ length }, () => 1);
|
|
18735
|
-
},
|
|
18736
|
-
arity: toFixedArity(1),
|
|
18737
|
-
},
|
|
18738
|
-
'zeros': {
|
|
18739
|
-
evaluate: ([length], sourceCodeInfo) => {
|
|
18740
|
-
assertNumber(length, sourceCodeInfo, { integer: true, nonNegative: true });
|
|
18741
|
-
return Array.from({ length }, () => 0);
|
|
18742
|
-
},
|
|
18743
|
-
arity: toFixedArity(1),
|
|
18744
|
-
},
|
|
18745
|
-
'fill': {
|
|
18746
|
-
evaluate: ([length, value], sourceCodeInfo) => {
|
|
18747
|
-
assertNumber(length, sourceCodeInfo, { integer: true, nonNegative: true });
|
|
18748
|
-
return Array.from({ length }, () => value);
|
|
18749
|
-
},
|
|
18750
|
-
arity: toFixedArity(2),
|
|
18751
|
-
},
|
|
18752
|
-
'generate': {
|
|
18753
|
-
evaluate: ([length, generator], sourceCodeInfo, contextStack, { executeFunction }) => {
|
|
18754
|
-
assertNumber(length, sourceCodeInfo, { integer: true, nonNegative: true });
|
|
18755
|
-
assertFunctionLike(generator, sourceCodeInfo);
|
|
18756
|
-
return mapSequential(Array.from({ length }), (_, i) => {
|
|
18757
|
-
return chain(executeFunction(generator, [i], contextStack, sourceCodeInfo), (value) => {
|
|
18758
|
-
assertNumber(value, sourceCodeInfo, { finite: true });
|
|
18759
|
-
return value;
|
|
18760
|
-
});
|
|
18761
|
-
});
|
|
18762
|
-
},
|
|
18763
|
-
arity: toFixedArity(2),
|
|
18764
|
-
},
|
|
18765
18690
|
'cumsum': {
|
|
18766
18691
|
evaluate: ([vector], sourceCodeInfo) => {
|
|
18767
18692
|
assertVector(vector, sourceCodeInfo);
|
|
@@ -19486,7 +19411,7 @@ const moduleDocs$2 = {
|
|
|
19486
19411
|
'let { orthogonal? } = import(linear-algebra);\northogonal?([1, 0, 1], [0, 1, 0])',
|
|
19487
19412
|
'let { orthogonal? } = import(linear-algebra);\northogonal?([1, 2], [2, -1])',
|
|
19488
19413
|
],
|
|
19489
|
-
seeAlso: ['linear-algebra.collinear?', 'linear-algebra.parallel?', 'linear-algebra.dot', 'matrix.orthogonal?', 'linear-algebra.angle'],
|
|
19414
|
+
seeAlso: ['linear-algebra.collinear?', 'linear-algebra.parallel?', 'linear-algebra.dot', 'matrix.orthogonal-matrix?', 'linear-algebra.angle'],
|
|
19490
19415
|
},
|
|
19491
19416
|
'cosine-similarity': {
|
|
19492
19417
|
category: 'linear-algebra',
|
|
@@ -20066,8 +19991,10 @@ const moduleDocs$2 = {
|
|
|
20066
19991
|
],
|
|
20067
19992
|
examples: [
|
|
20068
19993
|
'let { solve } = import(linear-algebra);\nsolve([\n [2, 1, -1, 1], \n [4, 5, -3, 2], \n [6, -2, 5, -3], \n [8, 3, 2, 4]\n], [5, 10, 2, 17])',
|
|
20069
|
-
|
|
20070
|
-
|
|
19994
|
+
`let { solve } = import(linear-algebra);
|
|
19995
|
+
solve([[2, 0, 0], [3, 1, 0], [4, 5, 6]], [4, 5, 38])`,
|
|
19996
|
+
`let { solve } = import(linear-algebra);
|
|
19997
|
+
solve([[2, 3], [1, -1]], [8, 2])`,
|
|
20071
19998
|
],
|
|
20072
19999
|
seeAlso: ['linear-algebra.rref', 'matrix.inv'],
|
|
20073
20000
|
},
|
|
@@ -21107,7 +21034,7 @@ const moduleDocs$1 = {
|
|
|
21107
21034
|
'let { inv } = import(matrix);\ninv([[1, 2], [3, 4]])',
|
|
21108
21035
|
'let { inv } = import(matrix);\ninv([[1, 2, 3], [4, 5, 7], [7, 8, 10]])',
|
|
21109
21036
|
],
|
|
21110
|
-
seeAlso: ['matrix.det', 'matrix.adj', 'matrix.invertible?', 'linear-algebra.solve', 'matrix.mul', 'matrix.orthogonal?'],
|
|
21037
|
+
seeAlso: ['matrix.det', 'matrix.adj', 'matrix.invertible?', 'linear-algebra.solve', 'matrix.mul', 'matrix.orthogonal-matrix?'],
|
|
21111
21038
|
},
|
|
21112
21039
|
'adj': {
|
|
21113
21040
|
category: 'matrix',
|
|
@@ -21244,7 +21171,7 @@ const moduleDocs$1 = {
|
|
|
21244
21171
|
'let { symmetric? } = import(matrix);\nsymmetric?([[1, 2], [2, 1]])',
|
|
21245
21172
|
'let { symmetric? } = import(matrix);\nsymmetric?([[1, 2, 3], [2, 1, 4], [3, 4, 1]])',
|
|
21246
21173
|
],
|
|
21247
|
-
seeAlso: ['matrix.orthogonal?', 'matrix.diagonal?', 'matrix.square?', 'matrix.hilbert'],
|
|
21174
|
+
seeAlso: ['matrix.orthogonal-matrix?', 'matrix.diagonal?', 'matrix.square?', 'matrix.hilbert'],
|
|
21248
21175
|
},
|
|
21249
21176
|
'triangular?': {
|
|
21250
21177
|
category: 'matrix',
|
|
@@ -21373,7 +21300,7 @@ const moduleDocs$1 = {
|
|
|
21373
21300
|
],
|
|
21374
21301
|
seeAlso: ['matrix.symmetric?', 'matrix.identity?', 'matrix.invertible?'],
|
|
21375
21302
|
},
|
|
21376
|
-
'orthogonal?': {
|
|
21303
|
+
'orthogonal-matrix?': {
|
|
21377
21304
|
category: 'matrix',
|
|
21378
21305
|
description: 'Checks if a `matrix` is **orthogonal**.',
|
|
21379
21306
|
returns: {
|
|
@@ -21393,9 +21320,9 @@ const moduleDocs$1 = {
|
|
|
21393
21320
|
},
|
|
21394
21321
|
],
|
|
21395
21322
|
examples: [
|
|
21396
|
-
'let { orthogonal? } = import(matrix);\northogonal?([[1, 0], [0, 1]])',
|
|
21397
|
-
'let { orthogonal? } = import(matrix);\northogonal?([[1, 0], [0, -1]])',
|
|
21398
|
-
'let { orthogonal? } = import(matrix);\northogonal?([[1, 2], [3, 4]])',
|
|
21323
|
+
'let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 0], [0, 1]])',
|
|
21324
|
+
'let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 0], [0, -1]])',
|
|
21325
|
+
'let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 2], [3, 4]])',
|
|
21399
21326
|
],
|
|
21400
21327
|
seeAlso: ['matrix.symmetric?', 'matrix.inv', 'matrix.identity?', 'linear-algebra.orthogonal?'],
|
|
21401
21328
|
},
|
|
@@ -21423,7 +21350,7 @@ const moduleDocs$1 = {
|
|
|
21423
21350
|
'let { identity? } = import(matrix);\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 1]])',
|
|
21424
21351
|
'let { identity? } = import(matrix);\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 0]])',
|
|
21425
21352
|
],
|
|
21426
|
-
seeAlso: ['matrix.diagonal?', 'matrix.square?', 'matrix.orthogonal?'],
|
|
21353
|
+
seeAlso: ['matrix.diagonal?', 'matrix.square?', 'matrix.orthogonal-matrix?'],
|
|
21427
21354
|
},
|
|
21428
21355
|
'invertible?': {
|
|
21429
21356
|
category: 'matrix',
|
|
@@ -22195,7 +22122,7 @@ const matrixNormalExpression = {
|
|
|
22195
22122
|
},
|
|
22196
22123
|
arity: toFixedArity(1),
|
|
22197
22124
|
},
|
|
22198
|
-
'orthogonal?': {
|
|
22125
|
+
'orthogonal-matrix?': {
|
|
22199
22126
|
evaluate: ([matrix], sourceCodeInfo) => {
|
|
22200
22127
|
assertMatrix(matrix, sourceCodeInfo);
|
|
22201
22128
|
return isOrthogonal(matrix);
|
|
@@ -29431,12 +29358,18 @@ const mathUtilsFunctions = {
|
|
|
29431
29358
|
description: 'The `sin` function computes the sine of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the sine of each element while preserving the original structure.',
|
|
29432
29359
|
seeAlso: ['math.asin', 'math.sinh', 'math.cos', 'math.tan', 'math.to-rad'],
|
|
29433
29360
|
examples: [
|
|
29434
|
-
|
|
29435
|
-
|
|
29436
|
-
|
|
29437
|
-
|
|
29438
|
-
|
|
29439
|
-
|
|
29361
|
+
`let { sin } = import(math);
|
|
29362
|
+
sin(0)`,
|
|
29363
|
+
`let { sin } = import(math);
|
|
29364
|
+
sin(1)`,
|
|
29365
|
+
`let { sin } = import(math);
|
|
29366
|
+
sin(PI)`,
|
|
29367
|
+
`let { sin } = import(math);
|
|
29368
|
+
sin(-0.5)`,
|
|
29369
|
+
`let { sin } = import(math);
|
|
29370
|
+
sin([1, 2, 3])`,
|
|
29371
|
+
`let { sin } = import(math);
|
|
29372
|
+
sin([[1, 2], [3, 4]])`,
|
|
29440
29373
|
],
|
|
29441
29374
|
},
|
|
29442
29375
|
},
|
|
@@ -29453,11 +29386,16 @@ const mathUtilsFunctions = {
|
|
|
29453
29386
|
description: 'The `asin` function computes the arcsine (inverse sine) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arcsine of each element while preserving the original structure.',
|
|
29454
29387
|
seeAlso: ['math.sin', 'math.asinh', 'math.acos', 'math.atan'],
|
|
29455
29388
|
examples: [
|
|
29456
|
-
|
|
29457
|
-
|
|
29458
|
-
|
|
29459
|
-
|
|
29460
|
-
|
|
29389
|
+
`let { asin } = import(math);
|
|
29390
|
+
asin(0)`,
|
|
29391
|
+
`let { asin } = import(math);
|
|
29392
|
+
asin(1)`,
|
|
29393
|
+
`let { asin } = import(math);
|
|
29394
|
+
asin(-0.5)`,
|
|
29395
|
+
`let { asin } = import(math);
|
|
29396
|
+
asin([1, 2, 3])`,
|
|
29397
|
+
`let { asin } = import(math);
|
|
29398
|
+
asin([[1, 2], [3, 4]])`,
|
|
29461
29399
|
],
|
|
29462
29400
|
},
|
|
29463
29401
|
},
|
|
@@ -29474,11 +29412,16 @@ const mathUtilsFunctions = {
|
|
|
29474
29412
|
description: 'The `sinh` function computes the hyperbolic sine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic sine of each element while preserving the original structure.',
|
|
29475
29413
|
seeAlso: ['math.asinh', 'math.sin', 'math.cosh', 'math.tanh'],
|
|
29476
29414
|
examples: [
|
|
29477
|
-
|
|
29478
|
-
|
|
29479
|
-
|
|
29480
|
-
|
|
29481
|
-
|
|
29415
|
+
`let { sinh } = import(math);
|
|
29416
|
+
sinh(0)`,
|
|
29417
|
+
`let { sinh } = import(math);
|
|
29418
|
+
sinh(1)`,
|
|
29419
|
+
`let { sinh } = import(math);
|
|
29420
|
+
sinh(-0.5)`,
|
|
29421
|
+
`let { sinh } = import(math);
|
|
29422
|
+
sinh([0.1, 0.2, 0.3])`,
|
|
29423
|
+
`let { sinh } = import(math);
|
|
29424
|
+
sinh([[0.1, 0.2], [0.3, 0.4]])`,
|
|
29482
29425
|
],
|
|
29483
29426
|
},
|
|
29484
29427
|
},
|
|
@@ -29495,11 +29438,16 @@ const mathUtilsFunctions = {
|
|
|
29495
29438
|
description: 'The `asinh` function computes the inverse hyperbolic sine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic sine of each element while preserving the original structure.',
|
|
29496
29439
|
seeAlso: ['math.sinh', 'math.asin', 'math.acosh', 'math.atanh'],
|
|
29497
29440
|
examples: [
|
|
29498
|
-
|
|
29499
|
-
|
|
29500
|
-
|
|
29501
|
-
|
|
29502
|
-
|
|
29441
|
+
`let { asinh } = import(math);
|
|
29442
|
+
asinh(10)`,
|
|
29443
|
+
`let { asinh } = import(math);
|
|
29444
|
+
asinh(90)`,
|
|
29445
|
+
`let { asinh } = import(math);
|
|
29446
|
+
asinh(50)`,
|
|
29447
|
+
`let { asinh } = import(math);
|
|
29448
|
+
asinh([10, 20, 30])`,
|
|
29449
|
+
`let { asinh } = import(math);
|
|
29450
|
+
asinh([[10, 20], [30, 40]])`,
|
|
29503
29451
|
],
|
|
29504
29452
|
},
|
|
29505
29453
|
},
|
|
@@ -29516,12 +29464,18 @@ const mathUtilsFunctions = {
|
|
|
29516
29464
|
description: 'The `cos` function computes the cosine of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the cosine of each element while preserving the original structure.',
|
|
29517
29465
|
seeAlso: ['math.acos', 'math.cosh', 'math.sin', 'math.tan', 'math.to-rad'],
|
|
29518
29466
|
examples: [
|
|
29519
|
-
|
|
29520
|
-
|
|
29521
|
-
|
|
29522
|
-
|
|
29523
|
-
|
|
29524
|
-
|
|
29467
|
+
`let { cos } = import(math);
|
|
29468
|
+
cos(0)`,
|
|
29469
|
+
`let { cos } = import(math);
|
|
29470
|
+
cos(1)`,
|
|
29471
|
+
`let { cos } = import(math);
|
|
29472
|
+
cos(PI)`,
|
|
29473
|
+
`let { cos } = import(math);
|
|
29474
|
+
cos(-0.5)`,
|
|
29475
|
+
`let { cos } = import(math);
|
|
29476
|
+
cos([1, 2, 3])`,
|
|
29477
|
+
`let { cos } = import(math);
|
|
29478
|
+
cos([[1, 2], [3, 4]])`,
|
|
29525
29479
|
],
|
|
29526
29480
|
},
|
|
29527
29481
|
},
|
|
@@ -29538,11 +29492,16 @@ const mathUtilsFunctions = {
|
|
|
29538
29492
|
description: 'The `acos` function computes the arccosine (inverse cosine) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arccosine of each element while preserving the original structure.',
|
|
29539
29493
|
seeAlso: ['math.cos', 'math.acosh', 'math.asin', 'math.atan'],
|
|
29540
29494
|
examples: [
|
|
29541
|
-
|
|
29542
|
-
|
|
29543
|
-
|
|
29544
|
-
|
|
29545
|
-
|
|
29495
|
+
`let { acos } = import(math);
|
|
29496
|
+
acos(0)`,
|
|
29497
|
+
`let { acos } = import(math);
|
|
29498
|
+
acos(1)`,
|
|
29499
|
+
`let { acos } = import(math);
|
|
29500
|
+
acos(-0.5)`,
|
|
29501
|
+
`let { acos } = import(math);
|
|
29502
|
+
acos([0.1, 0.2, 0.3])`,
|
|
29503
|
+
`let { acos } = import(math);
|
|
29504
|
+
acos([[0.1, 0.2], [0.3, 0.4]])`,
|
|
29546
29505
|
],
|
|
29547
29506
|
},
|
|
29548
29507
|
},
|
|
@@ -29559,11 +29518,16 @@ const mathUtilsFunctions = {
|
|
|
29559
29518
|
description: 'The `cosh` function computes the hyperbolic cosine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic cosine of each element while preserving the original structure.',
|
|
29560
29519
|
seeAlso: ['math.acosh', 'math.cos', 'math.sinh', 'math.tanh'],
|
|
29561
29520
|
examples: [
|
|
29562
|
-
|
|
29563
|
-
|
|
29564
|
-
|
|
29565
|
-
|
|
29566
|
-
|
|
29521
|
+
`let { cosh } = import(math);
|
|
29522
|
+
cosh(0)`,
|
|
29523
|
+
`let { cosh } = import(math);
|
|
29524
|
+
cosh(1)`,
|
|
29525
|
+
`let { cosh } = import(math);
|
|
29526
|
+
cosh(-0.5)`,
|
|
29527
|
+
`let { cosh } = import(math);
|
|
29528
|
+
cosh([0.1, 0.2, 0.3])`,
|
|
29529
|
+
`let { cosh } = import(math);
|
|
29530
|
+
cosh([[0.1, 0.2], [0.3, 0.4]])`,
|
|
29567
29531
|
],
|
|
29568
29532
|
},
|
|
29569
29533
|
},
|
|
@@ -29580,12 +29544,18 @@ const mathUtilsFunctions = {
|
|
|
29580
29544
|
description: 'The `acosh` function computes the inverse hyperbolic cosine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic cosine of each element while preserving the original structure.',
|
|
29581
29545
|
seeAlso: ['math.cosh', 'math.acos', 'math.asinh', 'math.atanh'],
|
|
29582
29546
|
examples: [
|
|
29583
|
-
|
|
29584
|
-
|
|
29585
|
-
|
|
29586
|
-
|
|
29587
|
-
|
|
29588
|
-
|
|
29547
|
+
`let { acosh } = import(math);
|
|
29548
|
+
acosh(1)`,
|
|
29549
|
+
`let { acosh } = import(math);
|
|
29550
|
+
acosh(2)`,
|
|
29551
|
+
`let { acosh } = import(math);
|
|
29552
|
+
acosh(100)`,
|
|
29553
|
+
`let { acosh } = import(math);
|
|
29554
|
+
acosh(50)`,
|
|
29555
|
+
`let { acosh } = import(math);
|
|
29556
|
+
acosh([1, 2, 3])`,
|
|
29557
|
+
`let { acosh } = import(math);
|
|
29558
|
+
acosh([[1, 2], [3, 4]])`,
|
|
29589
29559
|
],
|
|
29590
29560
|
},
|
|
29591
29561
|
},
|
|
@@ -29602,12 +29572,18 @@ const mathUtilsFunctions = {
|
|
|
29602
29572
|
description: 'The `tan` function computes the tangent of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the tangent of each element while preserving the original structure.',
|
|
29603
29573
|
seeAlso: ['math.atan', 'math.tanh', 'math.sin', 'math.cos', 'math.to-rad'],
|
|
29604
29574
|
examples: [
|
|
29605
|
-
|
|
29606
|
-
|
|
29607
|
-
|
|
29608
|
-
|
|
29609
|
-
|
|
29610
|
-
|
|
29575
|
+
`let { tan } = import(math);
|
|
29576
|
+
tan(0)`,
|
|
29577
|
+
`let { tan } = import(math);
|
|
29578
|
+
tan(1)`,
|
|
29579
|
+
`let { tan } = import(math);
|
|
29580
|
+
tan(PI)`,
|
|
29581
|
+
`let { tan } = import(math);
|
|
29582
|
+
tan(-0.5)`,
|
|
29583
|
+
`let { tan } = import(math);
|
|
29584
|
+
tan([1, 2, 3])`,
|
|
29585
|
+
`let { tan } = import(math);
|
|
29586
|
+
tan([[1, 2], [3, 4]])`,
|
|
29611
29587
|
],
|
|
29612
29588
|
},
|
|
29613
29589
|
},
|
|
@@ -29624,11 +29600,16 @@ const mathUtilsFunctions = {
|
|
|
29624
29600
|
description: 'The `atan` function computes the arctangent (inverse tangent) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arctangent of each element while preserving the original structure.',
|
|
29625
29601
|
seeAlso: ['math.tan', 'math.atanh', 'math.asin', 'math.acos'],
|
|
29626
29602
|
examples: [
|
|
29627
|
-
|
|
29628
|
-
|
|
29629
|
-
|
|
29630
|
-
|
|
29631
|
-
|
|
29603
|
+
`let { atan } = import(math);
|
|
29604
|
+
atan(0)`,
|
|
29605
|
+
`let { atan } = import(math);
|
|
29606
|
+
atan(1)`,
|
|
29607
|
+
`let { atan } = import(math);
|
|
29608
|
+
atan(-0.5)`,
|
|
29609
|
+
`let { atan } = import(math);
|
|
29610
|
+
atan([0.1, 0.2, 0.3])`,
|
|
29611
|
+
`let { atan } = import(math);
|
|
29612
|
+
atan([[0.1, 0.2], [0.3, 0.4]])`,
|
|
29632
29613
|
],
|
|
29633
29614
|
},
|
|
29634
29615
|
},
|
|
@@ -29645,10 +29626,14 @@ const mathUtilsFunctions = {
|
|
|
29645
29626
|
description: 'The `tanh` function computes the hyperbolic tangent of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic tangent of each element while preserving the original structure.',
|
|
29646
29627
|
seeAlso: ['math.atanh', 'math.tan', 'math.sinh', 'math.cosh'],
|
|
29647
29628
|
examples: [
|
|
29648
|
-
|
|
29649
|
-
|
|
29650
|
-
|
|
29651
|
-
|
|
29629
|
+
`let { tanh } = import(math);
|
|
29630
|
+
tanh(0)`,
|
|
29631
|
+
`let { tanh } = import(math);
|
|
29632
|
+
tanh(1)`,
|
|
29633
|
+
`let { tanh } = import(math);
|
|
29634
|
+
tanh(-0.5)`,
|
|
29635
|
+
`let { tanh } = import(math);
|
|
29636
|
+
tanh(50)`,
|
|
29652
29637
|
],
|
|
29653
29638
|
},
|
|
29654
29639
|
},
|
|
@@ -29665,11 +29650,16 @@ const mathUtilsFunctions = {
|
|
|
29665
29650
|
description: 'The `atanh` function computes the inverse hyperbolic tangent of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic tangent of each element while preserving the original structure.',
|
|
29666
29651
|
seeAlso: ['math.tanh', 'math.atan', 'math.asinh', 'math.acosh'],
|
|
29667
29652
|
examples: [
|
|
29668
|
-
|
|
29669
|
-
|
|
29670
|
-
|
|
29671
|
-
|
|
29672
|
-
|
|
29653
|
+
`let { atanh } = import(math);
|
|
29654
|
+
atanh(0)`,
|
|
29655
|
+
`let { atanh } = import(math);
|
|
29656
|
+
atanh(0.9)`,
|
|
29657
|
+
`let { atanh } = import(math);
|
|
29658
|
+
atanh(-0.5)`,
|
|
29659
|
+
`let { atanh } = import(math);
|
|
29660
|
+
atanh([0.1, 0.2, 0.3])`,
|
|
29661
|
+
`let { atanh } = import(math);
|
|
29662
|
+
atanh([[0.1, 0.2], [0.3, 0.4]])`,
|
|
29673
29663
|
],
|
|
29674
29664
|
},
|
|
29675
29665
|
},
|
|
@@ -29686,11 +29676,16 @@ const mathUtilsFunctions = {
|
|
|
29686
29676
|
description: 'The `ln` function computes the natural logarithm (base `e`) of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the natural logarithm of each element while preserving the original structure.',
|
|
29687
29677
|
seeAlso: ['math.log2', 'math.log10', '^'],
|
|
29688
29678
|
examples: [
|
|
29689
|
-
|
|
29690
|
-
|
|
29691
|
-
|
|
29692
|
-
|
|
29693
|
-
|
|
29679
|
+
`let { ln } = import(math);
|
|
29680
|
+
ln(0.01)`,
|
|
29681
|
+
`let { ln } = import(math);
|
|
29682
|
+
ln(2.5)`,
|
|
29683
|
+
`let { ln } = import(math);
|
|
29684
|
+
ln(E)`,
|
|
29685
|
+
`let { ln } = import(math);
|
|
29686
|
+
ln([1, 2, 3])`,
|
|
29687
|
+
`let { ln } = import(math);
|
|
29688
|
+
ln([[1, 2], [3, 4]])`,
|
|
29694
29689
|
],
|
|
29695
29690
|
},
|
|
29696
29691
|
},
|
|
@@ -29707,11 +29702,16 @@ const mathUtilsFunctions = {
|
|
|
29707
29702
|
description: 'The `log2` function computes the base `2` logarithm of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the base-2 logarithm of each element while preserving the original structure.',
|
|
29708
29703
|
seeAlso: ['math.ln', 'math.log10'],
|
|
29709
29704
|
examples: [
|
|
29710
|
-
|
|
29711
|
-
|
|
29712
|
-
|
|
29713
|
-
|
|
29714
|
-
|
|
29705
|
+
`let { log2 } = import(math);
|
|
29706
|
+
log2(0.01)`,
|
|
29707
|
+
`let { log2 } = import(math);
|
|
29708
|
+
log2(2 ^ 12)`,
|
|
29709
|
+
`let { log2 } = import(math);
|
|
29710
|
+
log2(2.5)`,
|
|
29711
|
+
`let { log2 } = import(math);
|
|
29712
|
+
log2([1, 2, 3])`,
|
|
29713
|
+
`let { log2 } = import(math);
|
|
29714
|
+
log2([[1, 2], [3, 4]])`,
|
|
29715
29715
|
],
|
|
29716
29716
|
},
|
|
29717
29717
|
},
|
|
@@ -29728,11 +29728,16 @@ const mathUtilsFunctions = {
|
|
|
29728
29728
|
description: 'The `log10` function computes the base `10` logarithm of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the base-10 logarithm of each element while preserving the original structure.',
|
|
29729
29729
|
seeAlso: ['math.ln', 'math.log2'],
|
|
29730
29730
|
examples: [
|
|
29731
|
-
|
|
29732
|
-
|
|
29733
|
-
|
|
29734
|
-
|
|
29735
|
-
|
|
29731
|
+
`let { log10 } = import(math);
|
|
29732
|
+
log10(0.01)`,
|
|
29733
|
+
`let { log10 } = import(math);
|
|
29734
|
+
log10(10 ^ 12)`,
|
|
29735
|
+
`let { log10 } = import(math);
|
|
29736
|
+
log10(2.5)`,
|
|
29737
|
+
`let { log10 } = import(math);
|
|
29738
|
+
log10([1, 2, 3])`,
|
|
29739
|
+
`let { log10 } = import(math);
|
|
29740
|
+
log10([[1, 2], [3, 4]])`,
|
|
29736
29741
|
],
|
|
29737
29742
|
},
|
|
29738
29743
|
},
|
|
@@ -29749,12 +29754,18 @@ const mathUtilsFunctions = {
|
|
|
29749
29754
|
description: 'The `to-rad` function converts an angle from degrees to radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it converts each element while preserving the original structure.',
|
|
29750
29755
|
seeAlso: ['math.to-deg', 'math.sin', 'math.cos', 'math.tan'],
|
|
29751
29756
|
examples: [
|
|
29752
|
-
|
|
29753
|
-
|
|
29754
|
-
|
|
29755
|
-
|
|
29756
|
-
|
|
29757
|
-
|
|
29757
|
+
`let { to-rad } = import(math);
|
|
29758
|
+
to-rad(0)`,
|
|
29759
|
+
`let { to-rad } = import(math);
|
|
29760
|
+
to-rad(90)`,
|
|
29761
|
+
`let { to-rad } = import(math);
|
|
29762
|
+
to-rad(180)`,
|
|
29763
|
+
`let { to-rad } = import(math);
|
|
29764
|
+
to-rad(360)`,
|
|
29765
|
+
`let { to-rad } = import(math);
|
|
29766
|
+
to-rad([0, 90, 180])`,
|
|
29767
|
+
`let { to-rad } = import(math);
|
|
29768
|
+
to-rad([[0, 90], [180, 360]])`,
|
|
29758
29769
|
],
|
|
29759
29770
|
},
|
|
29760
29771
|
},
|
|
@@ -29771,12 +29782,18 @@ const mathUtilsFunctions = {
|
|
|
29771
29782
|
description: 'The `to-deg` function converts an angle from radians to degrees, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it converts each element while preserving the original structure.',
|
|
29772
29783
|
seeAlso: ['math.to-rad'],
|
|
29773
29784
|
examples: [
|
|
29774
|
-
|
|
29775
|
-
|
|
29776
|
-
|
|
29777
|
-
|
|
29778
|
-
|
|
29779
|
-
|
|
29785
|
+
`let { to-deg } = import(math);
|
|
29786
|
+
to-deg(0)`,
|
|
29787
|
+
`let { to-deg } = import(math);
|
|
29788
|
+
to-deg(PI)`,
|
|
29789
|
+
`let { to-deg } = import(math);
|
|
29790
|
+
to-deg(PI / 2)`,
|
|
29791
|
+
`let { to-deg } = import(math);
|
|
29792
|
+
to-deg(3 * PI / 2)`,
|
|
29793
|
+
`let { to-deg } = import(math);
|
|
29794
|
+
to-deg([0, PI, PI / 2])`,
|
|
29795
|
+
`let { to-deg } = import(math);
|
|
29796
|
+
to-deg([[0, PI], [PI / 2, 3 * PI / 2]])`,
|
|
29780
29797
|
],
|
|
29781
29798
|
},
|
|
29782
29799
|
},
|
|
@@ -30009,9 +30026,12 @@ const stringUtilsFunctions = {
|
|
|
30009
30026
|
description: 'Repeates $s $n times.',
|
|
30010
30027
|
seeAlso: ['str', 'repeat'],
|
|
30011
30028
|
examples: [
|
|
30012
|
-
|
|
30013
|
-
|
|
30014
|
-
|
|
30029
|
+
`let { string-repeat } = import(string);
|
|
30030
|
+
"*" string-repeat 10`,
|
|
30031
|
+
`let { string-repeat } = import(string);
|
|
30032
|
+
string-repeat("*", 10)`,
|
|
30033
|
+
`let { string-repeat } = import(string);
|
|
30034
|
+
string-repeat("***", 0)`,
|
|
30015
30035
|
],
|
|
30016
30036
|
},
|
|
30017
30037
|
},
|
|
@@ -30035,8 +30055,10 @@ const stringUtilsFunctions = {
|
|
|
30035
30055
|
description: 'Return character for code point $code.',
|
|
30036
30056
|
seeAlso: ['string.to-char-code'],
|
|
30037
30057
|
examples: [
|
|
30038
|
-
|
|
30039
|
-
|
|
30058
|
+
`let { from-char-code } = import(string);
|
|
30059
|
+
from-char-code(65)`,
|
|
30060
|
+
`let { from-char-code } = import(string);
|
|
30061
|
+
from-char-code(0)`,
|
|
30040
30062
|
],
|
|
30041
30063
|
},
|
|
30042
30064
|
},
|
|
@@ -30054,8 +30076,10 @@ const stringUtilsFunctions = {
|
|
|
30054
30076
|
description: 'Return code point for first character in $c.',
|
|
30055
30077
|
seeAlso: ['string.from-char-code'],
|
|
30056
30078
|
examples: [
|
|
30057
|
-
|
|
30058
|
-
|
|
30079
|
+
`let { to-char-code } = import(string);
|
|
30080
|
+
to-char-code("A")`,
|
|
30081
|
+
`let { to-char-code } = import(string);
|
|
30082
|
+
to-char-code("Albert")`,
|
|
30059
30083
|
],
|
|
30060
30084
|
},
|
|
30061
30085
|
},
|
|
@@ -30073,9 +30097,12 @@ const stringUtilsFunctions = {
|
|
|
30073
30097
|
description: 'Returns a new string with leading whitespaces removed.',
|
|
30074
30098
|
seeAlso: ['trim', 'string.trim-right'],
|
|
30075
30099
|
examples: [
|
|
30076
|
-
|
|
30077
|
-
|
|
30078
|
-
|
|
30100
|
+
`let { trim-left } = import(string);
|
|
30101
|
+
trim-left(" Albert ")`,
|
|
30102
|
+
`let { trim-left } = import(string);
|
|
30103
|
+
trim-left(" ")`,
|
|
30104
|
+
`let { trim-left } = import(string);
|
|
30105
|
+
trim-left("")`,
|
|
30079
30106
|
],
|
|
30080
30107
|
},
|
|
30081
30108
|
},
|
|
@@ -30093,9 +30120,12 @@ const stringUtilsFunctions = {
|
|
|
30093
30120
|
description: 'Returns a new string with trailing whitespaces removed.',
|
|
30094
30121
|
seeAlso: ['trim', 'string.trim-left'],
|
|
30095
30122
|
examples: [
|
|
30096
|
-
|
|
30097
|
-
|
|
30098
|
-
|
|
30123
|
+
`let { trim-right } = import(string);
|
|
30124
|
+
trim-right(" Albert ")`,
|
|
30125
|
+
`let { trim-right } = import(string);
|
|
30126
|
+
trim-right(" ")`,
|
|
30127
|
+
`let { trim-right } = import(string);
|
|
30128
|
+
trim-right("")`,
|
|
30099
30129
|
],
|
|
30100
30130
|
},
|
|
30101
30131
|
},
|
|
@@ -30113,10 +30143,14 @@ const stringUtilsFunctions = {
|
|
|
30113
30143
|
description: 'Divides $s into an array of substrings, each representing a line.',
|
|
30114
30144
|
seeAlso: ['split'],
|
|
30115
30145
|
examples: [
|
|
30116
|
-
|
|
30117
|
-
|
|
30118
|
-
|
|
30119
|
-
|
|
30146
|
+
`let { split-lines } = import(string);
|
|
30147
|
+
split-lines("Albert\nMojir\n")`,
|
|
30148
|
+
`let { split-lines } = import(string);
|
|
30149
|
+
split-lines("Albert\n\nMojir")`,
|
|
30150
|
+
`let { split-lines } = import(string);
|
|
30151
|
+
split-lines("Albert\nMojir\n\n")`,
|
|
30152
|
+
`let { split-lines } = import(string);
|
|
30153
|
+
split-lines("")`,
|
|
30120
30154
|
],
|
|
30121
30155
|
},
|
|
30122
30156
|
},
|
|
@@ -30146,11 +30180,16 @@ const stringUtilsFunctions = {
|
|
|
30146
30180
|
description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given $length.',
|
|
30147
30181
|
seeAlso: ['string.pad-right'],
|
|
30148
30182
|
examples: [
|
|
30149
|
-
|
|
30150
|
-
|
|
30151
|
-
|
|
30152
|
-
|
|
30153
|
-
|
|
30183
|
+
`let { pad-left } = import(string);
|
|
30184
|
+
"Albert" pad-left 20`,
|
|
30185
|
+
`let { pad-left } = import(string);
|
|
30186
|
+
pad-left("Albert", 20)`,
|
|
30187
|
+
`let { pad-left } = import(string);
|
|
30188
|
+
pad-left("Albert", 20, "-*-")`,
|
|
30189
|
+
`let { pad-left } = import(string);
|
|
30190
|
+
pad-left("Albert", 5)`,
|
|
30191
|
+
`let { pad-left } = import(string);
|
|
30192
|
+
pad-left("Albert", -1)`,
|
|
30154
30193
|
],
|
|
30155
30194
|
},
|
|
30156
30195
|
},
|
|
@@ -30180,11 +30219,16 @@ const stringUtilsFunctions = {
|
|
|
30180
30219
|
description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given `length`.',
|
|
30181
30220
|
seeAlso: ['string.pad-left'],
|
|
30182
30221
|
examples: [
|
|
30183
|
-
|
|
30184
|
-
|
|
30185
|
-
|
|
30186
|
-
|
|
30187
|
-
|
|
30222
|
+
`let { pad-right } = import(string);
|
|
30223
|
+
"Albert" pad-right 20`,
|
|
30224
|
+
`let { pad-right } = import(string);
|
|
30225
|
+
pad-right("Albert", 20)`,
|
|
30226
|
+
`let { pad-right } = import(string);
|
|
30227
|
+
pad-right("Albert", 20, "-*-")`,
|
|
30228
|
+
`let { pad-right } = import(string);
|
|
30229
|
+
pad-right("Albert", 5)`,
|
|
30230
|
+
`let { pad-right } = import(string);
|
|
30231
|
+
pad-right("Albert", -1)`,
|
|
30188
30232
|
],
|
|
30189
30233
|
},
|
|
30190
30234
|
},
|
|
@@ -30228,19 +30272,32 @@ const stringUtilsFunctions = {
|
|
|
30228
30272
|
description: 'Applies placeholders to a string. Support for basic pluralization - see examples. If pluralization is used, first placeholder must be a number.',
|
|
30229
30273
|
seeAlso: ['str'],
|
|
30230
30274
|
examples: [
|
|
30231
|
-
|
|
30232
|
-
|
|
30233
|
-
|
|
30234
|
-
|
|
30235
|
-
|
|
30236
|
-
|
|
30237
|
-
|
|
30238
|
-
|
|
30239
|
-
|
|
30240
|
-
|
|
30241
|
-
|
|
30242
|
-
|
|
30243
|
-
|
|
30275
|
+
`let { template } = import(string);
|
|
30276
|
+
template("Hi, $1 and $2", "Carl", "Larry")`,
|
|
30277
|
+
`let { template } = import(string);
|
|
30278
|
+
template("Hi $1, $2, $3, $4, $5, $6, $7, $8 and $9", "A", "B", "C", "D", "E", "F", "G", "H", "I")`,
|
|
30279
|
+
`let { template } = import(string);
|
|
30280
|
+
template("$1 book||||$1 books", 0)`,
|
|
30281
|
+
`let { template } = import(string);
|
|
30282
|
+
template("$1 book||||$1 books", 1)`,
|
|
30283
|
+
`let { template } = import(string);
|
|
30284
|
+
template("$1 book||||$1 books", 2)`,
|
|
30285
|
+
`let { template } = import(string);
|
|
30286
|
+
template("No book||||$1 book||||$1 books", 0)`,
|
|
30287
|
+
`let { template } = import(string);
|
|
30288
|
+
template("No book||||$1 book||||$1 books", 1)`,
|
|
30289
|
+
`let { template } = import(string);
|
|
30290
|
+
template("No book||||$1 book||||$1 books", 10)`,
|
|
30291
|
+
`let { template } = import(string);
|
|
30292
|
+
template("No book||||One book||||Two books||||Three books||||$1 books", 0)`,
|
|
30293
|
+
`let { template } = import(string);
|
|
30294
|
+
template("No book||||One book||||Two books||||Three books||||$1 books", 1)`,
|
|
30295
|
+
`let { template } = import(string);
|
|
30296
|
+
template("No book||||One book||||Two books||||Three books||||$1 books", 2)`,
|
|
30297
|
+
`let { template } = import(string);
|
|
30298
|
+
template("No book||||One book||||Two books||||Three books||||$1 books", 3)`,
|
|
30299
|
+
`let { template } = import(string);
|
|
30300
|
+
template("No book||||One book||||Two books||||Three books||||$1 books", 4)`,
|
|
30244
30301
|
],
|
|
30245
30302
|
hideOperatorForm: true,
|
|
30246
30303
|
},
|
|
@@ -30262,7 +30319,8 @@ const stringUtilsFunctions = {
|
|
|
30262
30319
|
description: 'Returns a Base64 encoded string from $s.',
|
|
30263
30320
|
seeAlso: ['string.decode-base64'],
|
|
30264
30321
|
examples: [
|
|
30265
|
-
|
|
30322
|
+
`let { encode-base64 } = import(string);
|
|
30323
|
+
encode-base64("Albert")`,
|
|
30266
30324
|
],
|
|
30267
30325
|
},
|
|
30268
30326
|
},
|
|
@@ -30290,7 +30348,8 @@ const stringUtilsFunctions = {
|
|
|
30290
30348
|
description: 'Returns a Base64 decoded string from $base64string.',
|
|
30291
30349
|
seeAlso: ['string.encode-base64'],
|
|
30292
30350
|
examples: [
|
|
30293
|
-
|
|
30351
|
+
`let { decode-base64 } = import(string);
|
|
30352
|
+
decode-base64("QWxiZXJ0IPCfkLs=")`,
|
|
30294
30353
|
],
|
|
30295
30354
|
},
|
|
30296
30355
|
},
|
|
@@ -30308,7 +30367,8 @@ const stringUtilsFunctions = {
|
|
|
30308
30367
|
description: 'Returns an escaped `URI` string.',
|
|
30309
30368
|
seeAlso: ['string.decode-uri-component'],
|
|
30310
30369
|
examples: [
|
|
30311
|
-
|
|
30370
|
+
`let { encode-uri-component } = import(string);
|
|
30371
|
+
encode-uri-component("Hi everyone!?")`,
|
|
30312
30372
|
],
|
|
30313
30373
|
},
|
|
30314
30374
|
},
|
|
@@ -30331,7 +30391,8 @@ const stringUtilsFunctions = {
|
|
|
30331
30391
|
description: 'Returns an un-escaped `URI` string.',
|
|
30332
30392
|
seeAlso: ['string.encode-uri-component'],
|
|
30333
30393
|
examples: [
|
|
30334
|
-
|
|
30394
|
+
`let { decode-uri-component } = import(string);
|
|
30395
|
+
decode-uri-component("Hi%20everyone!%3F%20%F0%9F%91%8D")`,
|
|
30335
30396
|
],
|
|
30336
30397
|
},
|
|
30337
30398
|
},
|
|
@@ -30349,10 +30410,14 @@ const stringUtilsFunctions = {
|
|
|
30349
30410
|
description: 'Returns $s with the first character converted to uppercase and the rest to lowercase.',
|
|
30350
30411
|
seeAlso: ['lower-case', 'upper-case'],
|
|
30351
30412
|
examples: [
|
|
30352
|
-
|
|
30353
|
-
|
|
30354
|
-
|
|
30355
|
-
|
|
30413
|
+
`let { capitalize } = import(string);
|
|
30414
|
+
capitalize("albert")`,
|
|
30415
|
+
`let { capitalize } = import(string);
|
|
30416
|
+
capitalize("ALBERT")`,
|
|
30417
|
+
`let { capitalize } = import(string);
|
|
30418
|
+
capitalize("aLBERT")`,
|
|
30419
|
+
`let { capitalize } = import(string);
|
|
30420
|
+
capitalize("")`,
|
|
30356
30421
|
],
|
|
30357
30422
|
},
|
|
30358
30423
|
},
|
|
@@ -31066,7 +31131,7 @@ cu.reductions(
|
|
|
31066
31131
|
},
|
|
31067
31132
|
variants: [{ argumentNames: ['a', 'b'] }],
|
|
31068
31133
|
description: 'Returns `true` if all entries in $a pass the test implemented by $b, otherwise returns `false`.',
|
|
31069
|
-
seeAlso: ['collection.any?', 'collection.not-every?', 'collection.not-any?', 'functional.every-pred', 'grid.every?'],
|
|
31134
|
+
seeAlso: ['collection.any?', 'collection.not-every?', 'collection.not-any?', 'functional.every-pred', 'grid.cell-every?'],
|
|
31070
31135
|
examples: [
|
|
31071
31136
|
'let cu = import(collection); cu.every?([1, 2, 3], number?)',
|
|
31072
31137
|
'let cu = import(collection); cu.every?([1, 2, 3], even?)',
|
|
@@ -31354,29 +31419,6 @@ su.position(
|
|
|
31354
31419
|
],
|
|
31355
31420
|
},
|
|
31356
31421
|
},
|
|
31357
|
-
'shift': {
|
|
31358
|
-
evaluate: ([seq], sourceCodeInfo) => {
|
|
31359
|
-
assertSeq(seq, sourceCodeInfo);
|
|
31360
|
-
if (typeof seq === 'string')
|
|
31361
|
-
return seq.substring(1);
|
|
31362
|
-
const copy = [...seq];
|
|
31363
|
-
copy.shift();
|
|
31364
|
-
return copy;
|
|
31365
|
-
},
|
|
31366
|
-
arity: toFixedArity(1),
|
|
31367
|
-
docs: {
|
|
31368
|
-
category: 'sequence',
|
|
31369
|
-
returns: { type: ['sequence', 'null'] },
|
|
31370
|
-
args: { seq: { type: 'sequence' } },
|
|
31371
|
-
variants: [{ argumentNames: ['seq'] }],
|
|
31372
|
-
description: 'Returns a copy of $seq with first element removed. If $seq is empty `null` is returned.',
|
|
31373
|
-
seeAlso: ['sequence.unshift', 'pop', 'rest'],
|
|
31374
|
-
examples: [
|
|
31375
|
-
'let su = import(sequence); su.shift([1, 2, 3])',
|
|
31376
|
-
'let su = import(sequence); su.shift([])',
|
|
31377
|
-
],
|
|
31378
|
-
},
|
|
31379
|
-
},
|
|
31380
31422
|
'splice': {
|
|
31381
31423
|
evaluate: (params, sourceCodeInfo) => {
|
|
31382
31424
|
const [seq, start, deleteCount, ...rest] = params;
|
|
@@ -31501,7 +31543,7 @@ su.position(
|
|
|
31501
31543
|
},
|
|
31502
31544
|
variants: [{ argumentNames: ['seq', 'values'] }],
|
|
31503
31545
|
description: 'Returns copy of $seq with $values added to the beginning.',
|
|
31504
|
-
seeAlso: ['push', '
|
|
31546
|
+
seeAlso: ['push', '++'],
|
|
31505
31547
|
examples: [
|
|
31506
31548
|
'let su = import(sequence); su.unshift([1, 2, 3], 4)',
|
|
31507
31549
|
'let su = import(sequence); su.unshift([1, 2, 3], 4)',
|
|
@@ -32174,6 +32216,380 @@ const bitwiseUtilsModule = {
|
|
|
32174
32216
|
functions: bitwiseUtilsNormalExpression,
|
|
32175
32217
|
};
|
|
32176
32218
|
|
|
32219
|
+
const lengthUnits = {
|
|
32220
|
+
baseUnit: 'm',
|
|
32221
|
+
description: 'length',
|
|
32222
|
+
units: {
|
|
32223
|
+
angstrom: 1e-10,
|
|
32224
|
+
um: 0.000001,
|
|
32225
|
+
mm: 0.001,
|
|
32226
|
+
cm: 0.01,
|
|
32227
|
+
m: 1,
|
|
32228
|
+
km: 1000,
|
|
32229
|
+
in: 0.0254,
|
|
32230
|
+
ft: 0.3048,
|
|
32231
|
+
yd: 0.9144,
|
|
32232
|
+
mi: 1609.344,
|
|
32233
|
+
nmi: 1852,
|
|
32234
|
+
},
|
|
32235
|
+
};
|
|
32236
|
+
const weightUnits = {
|
|
32237
|
+
baseUnit: 'kg',
|
|
32238
|
+
description: 'weight',
|
|
32239
|
+
units: {
|
|
32240
|
+
mg: 0.000001,
|
|
32241
|
+
g: 0.001,
|
|
32242
|
+
kg: 1,
|
|
32243
|
+
t: 1000,
|
|
32244
|
+
oz: 0.028349523125,
|
|
32245
|
+
lb: 0.45359237,
|
|
32246
|
+
st: 6.35029318,
|
|
32247
|
+
},
|
|
32248
|
+
};
|
|
32249
|
+
const volumeUnits = {
|
|
32250
|
+
baseUnit: 'l',
|
|
32251
|
+
description: 'volume',
|
|
32252
|
+
units: {
|
|
32253
|
+
'ml': 0.001,
|
|
32254
|
+
'cl': 0.01,
|
|
32255
|
+
'dl': 0.1,
|
|
32256
|
+
'l': 1,
|
|
32257
|
+
'tsp': 0.00492892159375,
|
|
32258
|
+
'tbsp': 0.01478676478125,
|
|
32259
|
+
'fl-oz': 0.0295735295625,
|
|
32260
|
+
'cup': 0.2365882365,
|
|
32261
|
+
'pt': 0.473176473,
|
|
32262
|
+
'qt': 0.946352946,
|
|
32263
|
+
'gal': 3.785411784,
|
|
32264
|
+
},
|
|
32265
|
+
};
|
|
32266
|
+
const timeUnits = {
|
|
32267
|
+
baseUnit: 's',
|
|
32268
|
+
description: 'time',
|
|
32269
|
+
units: {
|
|
32270
|
+
ms: 0.001,
|
|
32271
|
+
s: 1,
|
|
32272
|
+
min: 60,
|
|
32273
|
+
h: 3600,
|
|
32274
|
+
day: 86400,
|
|
32275
|
+
week: 604800,
|
|
32276
|
+
},
|
|
32277
|
+
};
|
|
32278
|
+
const areaUnits = {
|
|
32279
|
+
baseUnit: 'm2',
|
|
32280
|
+
description: 'area',
|
|
32281
|
+
units: {
|
|
32282
|
+
mm2: 0.000001,
|
|
32283
|
+
cm2: 0.0001,
|
|
32284
|
+
m2: 1,
|
|
32285
|
+
km2: 1000000,
|
|
32286
|
+
in2: 0.00064516,
|
|
32287
|
+
ft2: 0.09290304,
|
|
32288
|
+
yd2: 0.83612736,
|
|
32289
|
+
acre: 4046.8564224,
|
|
32290
|
+
hectare: 10000,
|
|
32291
|
+
},
|
|
32292
|
+
};
|
|
32293
|
+
const speedUnits = {
|
|
32294
|
+
baseUnit: 'm/s',
|
|
32295
|
+
description: 'speed',
|
|
32296
|
+
units: {
|
|
32297
|
+
'm/s': 1,
|
|
32298
|
+
'km/h': 1 / 3.6,
|
|
32299
|
+
'mph': 0.44704,
|
|
32300
|
+
'kn': 0.514444,
|
|
32301
|
+
'ft/s': 0.3048,
|
|
32302
|
+
},
|
|
32303
|
+
};
|
|
32304
|
+
const dataUnits = {
|
|
32305
|
+
baseUnit: 'b',
|
|
32306
|
+
description: 'data',
|
|
32307
|
+
units: {
|
|
32308
|
+
b: 1,
|
|
32309
|
+
kb: 1000,
|
|
32310
|
+
mb: 1000000,
|
|
32311
|
+
gb: 1e9,
|
|
32312
|
+
tb: 1e12,
|
|
32313
|
+
pb: 1e15,
|
|
32314
|
+
},
|
|
32315
|
+
};
|
|
32316
|
+
const pressureUnits = {
|
|
32317
|
+
baseUnit: 'pa',
|
|
32318
|
+
description: 'pressure',
|
|
32319
|
+
units: {
|
|
32320
|
+
pa: 1,
|
|
32321
|
+
kpa: 1000,
|
|
32322
|
+
bar: 100000,
|
|
32323
|
+
atm: 101325,
|
|
32324
|
+
psi: 6894.757293168,
|
|
32325
|
+
mmhg: 133.322387415,
|
|
32326
|
+
},
|
|
32327
|
+
};
|
|
32328
|
+
const energyUnits = {
|
|
32329
|
+
baseUnit: 'j',
|
|
32330
|
+
description: 'energy',
|
|
32331
|
+
units: {
|
|
32332
|
+
j: 1,
|
|
32333
|
+
kj: 1000,
|
|
32334
|
+
cal: 4.184,
|
|
32335
|
+
kcal: 4184,
|
|
32336
|
+
wh: 3600,
|
|
32337
|
+
kwh: 3600000,
|
|
32338
|
+
btu: 1055.06,
|
|
32339
|
+
},
|
|
32340
|
+
};
|
|
32341
|
+
const powerUnits = {
|
|
32342
|
+
baseUnit: 'w',
|
|
32343
|
+
description: 'power',
|
|
32344
|
+
units: {
|
|
32345
|
+
w: 1,
|
|
32346
|
+
kw: 1000,
|
|
32347
|
+
mw: 1000000,
|
|
32348
|
+
hp: 745.7,
|
|
32349
|
+
},
|
|
32350
|
+
};
|
|
32351
|
+
const frequencyUnits = {
|
|
32352
|
+
baseUnit: 'hz',
|
|
32353
|
+
description: 'frequency',
|
|
32354
|
+
units: {
|
|
32355
|
+
hz: 1,
|
|
32356
|
+
khz: 1000,
|
|
32357
|
+
mhz: 1000000,
|
|
32358
|
+
ghz: 1000000000,
|
|
32359
|
+
},
|
|
32360
|
+
};
|
|
32361
|
+
const angleUnits = {
|
|
32362
|
+
baseUnit: 'rad',
|
|
32363
|
+
description: 'angle',
|
|
32364
|
+
units: {
|
|
32365
|
+
deg: Math.PI / 180,
|
|
32366
|
+
rad: 1,
|
|
32367
|
+
grad: Math.PI / 200,
|
|
32368
|
+
turn: 2 * Math.PI,
|
|
32369
|
+
},
|
|
32370
|
+
};
|
|
32371
|
+
// --- Temperature conversion functions ---
|
|
32372
|
+
function celsiusTo(unit, value) {
|
|
32373
|
+
switch (unit) {
|
|
32374
|
+
case 'c': return value;
|
|
32375
|
+
case 'f': return value * 9 / 5 + 32;
|
|
32376
|
+
case 'k': return value + 273.15;
|
|
32377
|
+
}
|
|
32378
|
+
}
|
|
32379
|
+
function toCelsius(unit, value) {
|
|
32380
|
+
switch (unit) {
|
|
32381
|
+
case 'c': return value;
|
|
32382
|
+
case 'f': return (value - 32) * 5 / 9;
|
|
32383
|
+
case 'k': return value - 273.15;
|
|
32384
|
+
}
|
|
32385
|
+
}
|
|
32386
|
+
const temperatureUnits = ['c', 'f', 'k'];
|
|
32387
|
+
const unitDescriptions = {
|
|
32388
|
+
// Length
|
|
32389
|
+
'angstrom': 'ångströms',
|
|
32390
|
+
'um': 'micrometers',
|
|
32391
|
+
'mm': 'millimeters',
|
|
32392
|
+
'cm': 'centimeters',
|
|
32393
|
+
'm': 'meters',
|
|
32394
|
+
'km': 'kilometers',
|
|
32395
|
+
'in': 'inches',
|
|
32396
|
+
'ft': 'feet',
|
|
32397
|
+
'yd': 'yards',
|
|
32398
|
+
'mi': 'miles',
|
|
32399
|
+
'nmi': 'nautical miles',
|
|
32400
|
+
// Weight
|
|
32401
|
+
'mg': 'milligrams',
|
|
32402
|
+
'g': 'grams',
|
|
32403
|
+
'kg': 'kilograms',
|
|
32404
|
+
't': 'metric tons',
|
|
32405
|
+
'oz': 'ounces',
|
|
32406
|
+
'lb': 'pounds',
|
|
32407
|
+
'st': 'stones',
|
|
32408
|
+
// Volume
|
|
32409
|
+
'ml': 'milliliters',
|
|
32410
|
+
'cl': 'centiliters',
|
|
32411
|
+
'dl': 'deciliters',
|
|
32412
|
+
'l': 'liters',
|
|
32413
|
+
'tsp': 'teaspoons',
|
|
32414
|
+
'tbsp': 'tablespoons',
|
|
32415
|
+
'fl-oz': 'fluid ounces',
|
|
32416
|
+
'cup': 'cups',
|
|
32417
|
+
'pt': 'pints',
|
|
32418
|
+
'qt': 'quarts',
|
|
32419
|
+
'gal': 'gallons',
|
|
32420
|
+
// Time
|
|
32421
|
+
'ms': 'milliseconds',
|
|
32422
|
+
's': 'seconds',
|
|
32423
|
+
'min': 'minutes',
|
|
32424
|
+
'h': 'hours',
|
|
32425
|
+
'day': 'days',
|
|
32426
|
+
'week': 'weeks',
|
|
32427
|
+
// Area
|
|
32428
|
+
'mm2': 'square millimeters',
|
|
32429
|
+
'cm2': 'square centimeters',
|
|
32430
|
+
'm2': 'square meters',
|
|
32431
|
+
'km2': 'square kilometers',
|
|
32432
|
+
'in2': 'square inches',
|
|
32433
|
+
'ft2': 'square feet',
|
|
32434
|
+
'yd2': 'square yards',
|
|
32435
|
+
'acre': 'acres',
|
|
32436
|
+
'hectare': 'hectares',
|
|
32437
|
+
// Speed
|
|
32438
|
+
'm/s': 'meters per second',
|
|
32439
|
+
'km/h': 'kilometers per hour',
|
|
32440
|
+
'mph': 'miles per hour',
|
|
32441
|
+
'kn': 'knots',
|
|
32442
|
+
'ft/s': 'feet per second',
|
|
32443
|
+
// Data
|
|
32444
|
+
'b': 'bytes',
|
|
32445
|
+
'kb': 'kilobytes',
|
|
32446
|
+
'mb': 'megabytes',
|
|
32447
|
+
'gb': 'gigabytes',
|
|
32448
|
+
'tb': 'terabytes',
|
|
32449
|
+
'pb': 'petabytes',
|
|
32450
|
+
// Pressure
|
|
32451
|
+
'pa': 'pascals',
|
|
32452
|
+
'kpa': 'kilopascals',
|
|
32453
|
+
'bar': 'bars',
|
|
32454
|
+
'atm': 'atmospheres',
|
|
32455
|
+
'psi': 'pounds per square inch',
|
|
32456
|
+
'mmhg': 'millimeters of mercury',
|
|
32457
|
+
// Energy
|
|
32458
|
+
'j': 'joules',
|
|
32459
|
+
'kj': 'kilojoules',
|
|
32460
|
+
'cal': 'calories',
|
|
32461
|
+
'kcal': 'kilocalories',
|
|
32462
|
+
'wh': 'watt-hours',
|
|
32463
|
+
'kwh': 'kilowatt-hours',
|
|
32464
|
+
'btu': 'British thermal units',
|
|
32465
|
+
// Power
|
|
32466
|
+
'w': 'watts',
|
|
32467
|
+
'kw': 'kilowatts',
|
|
32468
|
+
'mw': 'megawatts',
|
|
32469
|
+
'hp': 'horsepower',
|
|
32470
|
+
// Frequency
|
|
32471
|
+
'hz': 'hertz',
|
|
32472
|
+
'khz': 'kilohertz',
|
|
32473
|
+
'mhz': 'megahertz',
|
|
32474
|
+
'ghz': 'gigahertz',
|
|
32475
|
+
// Angle
|
|
32476
|
+
'deg': 'degrees',
|
|
32477
|
+
'rad': 'radians',
|
|
32478
|
+
'grad': 'gradians',
|
|
32479
|
+
'turn': 'turns',
|
|
32480
|
+
// Temperature
|
|
32481
|
+
'c': 'Celsius',
|
|
32482
|
+
'f': 'Fahrenheit',
|
|
32483
|
+
'k': 'Kelvin',
|
|
32484
|
+
};
|
|
32485
|
+
// --- Generate linear conversion functions ---
|
|
32486
|
+
function generateLinearConversions(category) {
|
|
32487
|
+
const result = {};
|
|
32488
|
+
const unitNames = Object.keys(category.units);
|
|
32489
|
+
for (const from of unitNames) {
|
|
32490
|
+
for (const to of unitNames) {
|
|
32491
|
+
if (from === to)
|
|
32492
|
+
continue;
|
|
32493
|
+
const fromFactor = category.units[from];
|
|
32494
|
+
const toFactor = category.units[to];
|
|
32495
|
+
const conversionFactor = fromFactor / toFactor;
|
|
32496
|
+
const fnName = `${from}->${to}`;
|
|
32497
|
+
const fromDesc = unitDescriptions[from];
|
|
32498
|
+
const toDesc = unitDescriptions[to];
|
|
32499
|
+
const seeAlso = [
|
|
32500
|
+
`convert.${to}->${from}`,
|
|
32501
|
+
...unitNames
|
|
32502
|
+
.filter(u => u !== from && u !== to)
|
|
32503
|
+
.map(u => `convert.${from}->${u}`),
|
|
32504
|
+
];
|
|
32505
|
+
result[fnName] = {
|
|
32506
|
+
evaluate: ([value], sourceCodeInfo) => {
|
|
32507
|
+
assertNumber(value, sourceCodeInfo);
|
|
32508
|
+
return value * conversionFactor;
|
|
32509
|
+
},
|
|
32510
|
+
arity: toFixedArity(1),
|
|
32511
|
+
docs: {
|
|
32512
|
+
category: 'convert',
|
|
32513
|
+
returns: { type: 'number' },
|
|
32514
|
+
args: {
|
|
32515
|
+
value: { type: 'number', description: `Value in ${fromDesc}` },
|
|
32516
|
+
},
|
|
32517
|
+
variants: [{ argumentNames: ['value'] }],
|
|
32518
|
+
description: `Converts a value from ${fromDesc} (\`${from}\`) to ${toDesc} (\`${to}\`).`,
|
|
32519
|
+
seeAlso,
|
|
32520
|
+
examples: [
|
|
32521
|
+
`let { ${fnName} } = import(convert);
|
|
32522
|
+
${fnName}(1)`,
|
|
32523
|
+
],
|
|
32524
|
+
},
|
|
32525
|
+
};
|
|
32526
|
+
}
|
|
32527
|
+
}
|
|
32528
|
+
return result;
|
|
32529
|
+
}
|
|
32530
|
+
// --- Generate temperature conversion functions ---
|
|
32531
|
+
function generateTemperatureConversions() {
|
|
32532
|
+
const result = {};
|
|
32533
|
+
for (const from of temperatureUnits) {
|
|
32534
|
+
for (const to of temperatureUnits) {
|
|
32535
|
+
if (from === to)
|
|
32536
|
+
continue;
|
|
32537
|
+
const fnName = `${from}->${to}`;
|
|
32538
|
+
const fromDesc = unitDescriptions[from];
|
|
32539
|
+
const toDesc = unitDescriptions[to];
|
|
32540
|
+
const seeAlso = [
|
|
32541
|
+
`convert.${to}->${from}`,
|
|
32542
|
+
...temperatureUnits
|
|
32543
|
+
.filter(u => u !== from && u !== to)
|
|
32544
|
+
.map(u => `convert.${from}->${u}`),
|
|
32545
|
+
];
|
|
32546
|
+
result[fnName] = {
|
|
32547
|
+
evaluate: ([value], sourceCodeInfo) => {
|
|
32548
|
+
assertNumber(value, sourceCodeInfo);
|
|
32549
|
+
const celsius = toCelsius(from, value);
|
|
32550
|
+
return celsiusTo(to, celsius);
|
|
32551
|
+
},
|
|
32552
|
+
arity: toFixedArity(1),
|
|
32553
|
+
docs: {
|
|
32554
|
+
category: 'convert',
|
|
32555
|
+
returns: { type: 'number' },
|
|
32556
|
+
args: {
|
|
32557
|
+
value: { type: 'number', description: `Value in ${fromDesc}` },
|
|
32558
|
+
},
|
|
32559
|
+
variants: [{ argumentNames: ['value'] }],
|
|
32560
|
+
description: `Converts a temperature from ${fromDesc} (\`${from}\`) to ${toDesc} (\`${to}\`).`,
|
|
32561
|
+
seeAlso,
|
|
32562
|
+
examples: [
|
|
32563
|
+
`let { ${fnName} } = import(convert);
|
|
32564
|
+
${fnName}(100)`,
|
|
32565
|
+
],
|
|
32566
|
+
},
|
|
32567
|
+
};
|
|
32568
|
+
}
|
|
32569
|
+
}
|
|
32570
|
+
return result;
|
|
32571
|
+
}
|
|
32572
|
+
// --- Assemble all conversion functions ---
|
|
32573
|
+
const convertFunctions = {
|
|
32574
|
+
...generateLinearConversions(lengthUnits),
|
|
32575
|
+
...generateLinearConversions(weightUnits),
|
|
32576
|
+
...generateLinearConversions(volumeUnits),
|
|
32577
|
+
...generateLinearConversions(timeUnits),
|
|
32578
|
+
...generateLinearConversions(areaUnits),
|
|
32579
|
+
...generateLinearConversions(speedUnits),
|
|
32580
|
+
...generateLinearConversions(dataUnits),
|
|
32581
|
+
...generateLinearConversions(pressureUnits),
|
|
32582
|
+
...generateLinearConversions(energyUnits),
|
|
32583
|
+
...generateLinearConversions(powerUnits),
|
|
32584
|
+
...generateLinearConversions(frequencyUnits),
|
|
32585
|
+
...generateLinearConversions(angleUnits),
|
|
32586
|
+
...generateTemperatureConversions(),
|
|
32587
|
+
};
|
|
32588
|
+
const convertModule = {
|
|
32589
|
+
name: 'convert',
|
|
32590
|
+
functions: convertFunctions,
|
|
32591
|
+
};
|
|
32592
|
+
|
|
32177
32593
|
const allBuiltinModules = [
|
|
32178
32594
|
assertModule,
|
|
32179
32595
|
gridModule,
|
|
@@ -32188,6 +32604,7 @@ const allBuiltinModules = [
|
|
|
32188
32604
|
collectionUtilsModule,
|
|
32189
32605
|
sequenceUtilsModule,
|
|
32190
32606
|
bitwiseUtilsModule,
|
|
32607
|
+
convertModule,
|
|
32191
32608
|
];
|
|
32192
32609
|
|
|
32193
32610
|
function runTest({ testPath: filePath, testNamePattern }) {
|
|
@@ -32556,7 +32973,7 @@ const shorthand = {
|
|
|
32556
32973
|
'#"^\\s*(.*)$"',
|
|
32557
32974
|
'#"albert"ig',
|
|
32558
32975
|
],
|
|
32559
|
-
seeAlso: ['regexp', 'match', 'replace', 'replace-all'],
|
|
32976
|
+
seeAlso: ['regexp', 're-match', 'replace', 'replace-all'],
|
|
32560
32977
|
},
|
|
32561
32978
|
'-short-fn': {
|
|
32562
32979
|
shorthand: true,
|
|
@@ -32568,7 +32985,7 @@ Shorthand for \`(args, ...) -> expression\`.
|
|
|
32568
32985
|
|
|
32569
32986
|
You can reference the first argument using either \`$1\` or \`$\`.
|
|
32570
32987
|
However, please note that \`$1\` and \`$\` are mutually exclusive and cannot be used simultaneously.
|
|
32571
|
-
E.g.
|
|
32988
|
+
E.g. \`-> $ * $1\` is not valid.`,
|
|
32572
32989
|
examples: [
|
|
32573
32990
|
'-> $1 + $2',
|
|
32574
32991
|
'(-> $ * $)(9)',
|
|
@@ -32622,6 +33039,7 @@ function moduledDocsToReference(moduleName, expressions) {
|
|
|
32622
33039
|
return result;
|
|
32623
33040
|
}
|
|
32624
33041
|
// Derive all core category references from co-located docs
|
|
33042
|
+
const assertionRef = docsToReference(assertionNormalExpression);
|
|
32625
33043
|
const bitwiseReference = docsToReference(bitwiseNormalExpression);
|
|
32626
33044
|
const arrayRef = docsToReference(arrayNormalExpression);
|
|
32627
33045
|
const collectionRef = docsToReference(collectionNormalExpression);
|
|
@@ -32679,6 +33097,7 @@ function isFunctionReference(ref) {
|
|
|
32679
33097
|
}
|
|
32680
33098
|
const normalExpressionReference = {
|
|
32681
33099
|
// Core categories — all derived from co-located docs
|
|
33100
|
+
...assertionRef,
|
|
32682
33101
|
...bitwiseReference,
|
|
32683
33102
|
...collectionRef,
|
|
32684
33103
|
...arrayRef,
|
|
@@ -32709,6 +33128,7 @@ const moduleReference = {
|
|
|
32709
33128
|
...moduledDocsToReference(mathUtilsModule.name, mathUtilsModule.functions),
|
|
32710
33129
|
...moduledDocsToReference(functionalUtilsModule.name, functionalUtilsModule.functions),
|
|
32711
33130
|
...moduledDocsToReference(bitwiseUtilsModule.name, bitwiseUtilsModule.functions),
|
|
33131
|
+
...moduledDocsToReference(convertModule.name, convertModule.functions),
|
|
32712
33132
|
};
|
|
32713
33133
|
Object.entries(normalExpressionReference).forEach(([key, obj]) => {
|
|
32714
33134
|
if (!normalExpressions[key]) {
|
|
@@ -33193,6 +33613,9 @@ function getVectorReductionNames(name) {
|
|
|
33193
33613
|
const baseName = name.replace(/^/, '');
|
|
33194
33614
|
return [`vector.${name}`, `vector.moving-${baseName}`, `vector.centered-moving-${baseName}`, `vector.running-${baseName}`];
|
|
33195
33615
|
}
|
|
33616
|
+
function getVectorMovingNames(name) {
|
|
33617
|
+
return [`vector.moving-${name}`, `vector.centered-moving-${name}`, `vector.running-${name}`];
|
|
33618
|
+
}
|
|
33196
33619
|
const api = {
|
|
33197
33620
|
collection: [
|
|
33198
33621
|
'filter',
|
|
@@ -33254,7 +33677,6 @@ const api = {
|
|
|
33254
33677
|
sequenceUtils: [
|
|
33255
33678
|
'sequence.position',
|
|
33256
33679
|
'sequence.last-index-of',
|
|
33257
|
-
'sequence.shift',
|
|
33258
33680
|
'sequence.unshift',
|
|
33259
33681
|
'sequence.splice',
|
|
33260
33682
|
'sequence.sort-by',
|
|
@@ -33390,7 +33812,7 @@ const api = {
|
|
|
33390
33812
|
],
|
|
33391
33813
|
regularExpression: [
|
|
33392
33814
|
'regexp',
|
|
33393
|
-
'match',
|
|
33815
|
+
're-match',
|
|
33394
33816
|
'replace',
|
|
33395
33817
|
'replace-all',
|
|
33396
33818
|
],
|
|
@@ -33436,38 +33858,40 @@ const api = {
|
|
|
33436
33858
|
'bitwise.bit-set',
|
|
33437
33859
|
'bitwise.bit-test',
|
|
33438
33860
|
],
|
|
33439
|
-
|
|
33440
|
-
'assert
|
|
33441
|
-
|
|
33442
|
-
|
|
33443
|
-
'
|
|
33444
|
-
'
|
|
33445
|
-
'
|
|
33446
|
-
'
|
|
33447
|
-
'
|
|
33448
|
-
'
|
|
33449
|
-
'
|
|
33450
|
-
'
|
|
33451
|
-
'
|
|
33452
|
-
'
|
|
33453
|
-
'
|
|
33454
|
-
'
|
|
33455
|
-
'
|
|
33456
|
-
'
|
|
33457
|
-
'
|
|
33458
|
-
'
|
|
33459
|
-
'
|
|
33460
|
-
'
|
|
33461
|
-
'
|
|
33462
|
-
'
|
|
33463
|
-
'
|
|
33464
|
-
'
|
|
33465
|
-
'
|
|
33466
|
-
'
|
|
33467
|
-
'
|
|
33861
|
+
assertion: [
|
|
33862
|
+
'assert',
|
|
33863
|
+
],
|
|
33864
|
+
assertionUtils: [
|
|
33865
|
+
'assertion.assert=',
|
|
33866
|
+
'assertion.assert!=',
|
|
33867
|
+
'assertion.assert-gt',
|
|
33868
|
+
'assertion.assert-lt',
|
|
33869
|
+
'assertion.assert-gte',
|
|
33870
|
+
'assertion.assert-lte',
|
|
33871
|
+
'assertion.assert-true',
|
|
33872
|
+
'assertion.assert-false',
|
|
33873
|
+
'assertion.assert-truthy',
|
|
33874
|
+
'assertion.assert-falsy',
|
|
33875
|
+
'assertion.assert-null',
|
|
33876
|
+
'assertion.assert-throws',
|
|
33877
|
+
'assertion.assert-throws-error',
|
|
33878
|
+
'assertion.assert-not-throws',
|
|
33879
|
+
'assertion.assert-array',
|
|
33880
|
+
'assertion.assert-boolean',
|
|
33881
|
+
'assertion.assert-collection',
|
|
33882
|
+
'assertion.assert-function',
|
|
33883
|
+
'assertion.assert-grid',
|
|
33884
|
+
'assertion.assert-integer',
|
|
33885
|
+
'assertion.assert-matrix',
|
|
33886
|
+
'assertion.assert-number',
|
|
33887
|
+
'assertion.assert-object',
|
|
33888
|
+
'assertion.assert-regexp',
|
|
33889
|
+
'assertion.assert-sequence',
|
|
33890
|
+
'assertion.assert-string',
|
|
33891
|
+
'assertion.assert-vector',
|
|
33468
33892
|
],
|
|
33469
33893
|
grid: [
|
|
33470
|
-
'grid.every?',
|
|
33894
|
+
'grid.cell-every?',
|
|
33471
33895
|
'grid.some?',
|
|
33472
33896
|
'grid.every-row?',
|
|
33473
33897
|
'grid.some-row?',
|
|
@@ -33483,19 +33907,17 @@ const api = {
|
|
|
33483
33907
|
'grid.flip-h',
|
|
33484
33908
|
'grid.flip-v',
|
|
33485
33909
|
'grid.rotate',
|
|
33486
|
-
'grid.
|
|
33487
|
-
'grid.reverse-cols',
|
|
33488
|
-
'grid.slice',
|
|
33910
|
+
'grid.crop',
|
|
33489
33911
|
'grid.slice-rows',
|
|
33490
33912
|
'grid.slice-cols',
|
|
33491
33913
|
'grid.splice-rows',
|
|
33492
33914
|
'grid.splice-cols',
|
|
33493
33915
|
'grid.concat-rows',
|
|
33494
33916
|
'grid.concat-cols',
|
|
33495
|
-
'grid.map',
|
|
33496
|
-
'grid.mapi',
|
|
33497
|
-
'grid.reduce',
|
|
33498
|
-
'grid.reducei',
|
|
33917
|
+
'grid.cell-map',
|
|
33918
|
+
'grid.cell-mapi',
|
|
33919
|
+
'grid.cell-reduce',
|
|
33920
|
+
'grid.cell-reducei',
|
|
33499
33921
|
'grid.push-rows',
|
|
33500
33922
|
'grid.unshift-rows',
|
|
33501
33923
|
'grid.pop-row',
|
|
@@ -33520,7 +33942,7 @@ const api = {
|
|
|
33520
33942
|
'matrix.lower-triangular?',
|
|
33521
33943
|
'matrix.diagonal?',
|
|
33522
33944
|
'matrix.square?',
|
|
33523
|
-
'matrix.orthogonal?',
|
|
33945
|
+
'matrix.orthogonal-matrix?',
|
|
33524
33946
|
'matrix.identity?',
|
|
33525
33947
|
'matrix.invertible?',
|
|
33526
33948
|
'matrix.hilbert',
|
|
@@ -33546,17 +33968,12 @@ const api = {
|
|
|
33546
33968
|
'vector.decreasing?',
|
|
33547
33969
|
'vector.strictly-increasing?',
|
|
33548
33970
|
'vector.strictly-decreasing?',
|
|
33549
|
-
'vector.median',
|
|
33550
33971
|
'vector.mode',
|
|
33551
33972
|
'vector.min-index',
|
|
33552
33973
|
'vector.max-index',
|
|
33553
33974
|
'vector.sort-indices',
|
|
33554
33975
|
'vector.count-values',
|
|
33555
33976
|
'vector.linspace',
|
|
33556
|
-
'vector.ones',
|
|
33557
|
-
'vector.zeros',
|
|
33558
|
-
'vector.fill',
|
|
33559
|
-
'vector.generate',
|
|
33560
33977
|
'vector.cumsum',
|
|
33561
33978
|
'vector.cumprod',
|
|
33562
33979
|
'vector.quartiles',
|
|
@@ -33572,12 +33989,12 @@ const api = {
|
|
|
33572
33989
|
'vector.mae',
|
|
33573
33990
|
'vector.rmse',
|
|
33574
33991
|
'vector.smape',
|
|
33575
|
-
...
|
|
33576
|
-
...
|
|
33992
|
+
...getVectorMovingNames('mean'),
|
|
33993
|
+
...getVectorMovingNames('median'),
|
|
33577
33994
|
...getVectorReductionNames('variance'),
|
|
33578
33995
|
...getVectorReductionNames('sample-variance'),
|
|
33579
|
-
...
|
|
33580
|
-
...
|
|
33996
|
+
...getVectorMovingNames('sum'),
|
|
33997
|
+
...getVectorMovingNames('prod'),
|
|
33581
33998
|
...getVectorReductionNames('stdev'),
|
|
33582
33999
|
...getVectorReductionNames('sample-stdev'),
|
|
33583
34000
|
...getVectorReductionNames('iqr'),
|
|
@@ -33734,6 +34151,536 @@ const api = {
|
|
|
33734
34151
|
'random.random-id!',
|
|
33735
34152
|
'random.random-color!',
|
|
33736
34153
|
],
|
|
34154
|
+
convert: [
|
|
34155
|
+
'convert.angstrom->um',
|
|
34156
|
+
'convert.angstrom->mm',
|
|
34157
|
+
'convert.angstrom->cm',
|
|
34158
|
+
'convert.angstrom->m',
|
|
34159
|
+
'convert.angstrom->km',
|
|
34160
|
+
'convert.angstrom->in',
|
|
34161
|
+
'convert.angstrom->ft',
|
|
34162
|
+
'convert.angstrom->yd',
|
|
34163
|
+
'convert.angstrom->mi',
|
|
34164
|
+
'convert.angstrom->nmi',
|
|
34165
|
+
'convert.um->angstrom',
|
|
34166
|
+
'convert.um->mm',
|
|
34167
|
+
'convert.um->cm',
|
|
34168
|
+
'convert.um->m',
|
|
34169
|
+
'convert.um->km',
|
|
34170
|
+
'convert.um->in',
|
|
34171
|
+
'convert.um->ft',
|
|
34172
|
+
'convert.um->yd',
|
|
34173
|
+
'convert.um->mi',
|
|
34174
|
+
'convert.um->nmi',
|
|
34175
|
+
'convert.mm->angstrom',
|
|
34176
|
+
'convert.mm->um',
|
|
34177
|
+
'convert.mm->cm',
|
|
34178
|
+
'convert.mm->m',
|
|
34179
|
+
'convert.mm->km',
|
|
34180
|
+
'convert.mm->in',
|
|
34181
|
+
'convert.mm->ft',
|
|
34182
|
+
'convert.mm->yd',
|
|
34183
|
+
'convert.mm->mi',
|
|
34184
|
+
'convert.mm->nmi',
|
|
34185
|
+
'convert.cm->angstrom',
|
|
34186
|
+
'convert.cm->um',
|
|
34187
|
+
'convert.cm->mm',
|
|
34188
|
+
'convert.cm->m',
|
|
34189
|
+
'convert.cm->km',
|
|
34190
|
+
'convert.cm->in',
|
|
34191
|
+
'convert.cm->ft',
|
|
34192
|
+
'convert.cm->yd',
|
|
34193
|
+
'convert.cm->mi',
|
|
34194
|
+
'convert.cm->nmi',
|
|
34195
|
+
'convert.m->angstrom',
|
|
34196
|
+
'convert.m->um',
|
|
34197
|
+
'convert.m->mm',
|
|
34198
|
+
'convert.m->cm',
|
|
34199
|
+
'convert.m->km',
|
|
34200
|
+
'convert.m->in',
|
|
34201
|
+
'convert.m->ft',
|
|
34202
|
+
'convert.m->yd',
|
|
34203
|
+
'convert.m->mi',
|
|
34204
|
+
'convert.m->nmi',
|
|
34205
|
+
'convert.km->angstrom',
|
|
34206
|
+
'convert.km->um',
|
|
34207
|
+
'convert.km->mm',
|
|
34208
|
+
'convert.km->cm',
|
|
34209
|
+
'convert.km->m',
|
|
34210
|
+
'convert.km->in',
|
|
34211
|
+
'convert.km->ft',
|
|
34212
|
+
'convert.km->yd',
|
|
34213
|
+
'convert.km->mi',
|
|
34214
|
+
'convert.km->nmi',
|
|
34215
|
+
'convert.in->angstrom',
|
|
34216
|
+
'convert.in->um',
|
|
34217
|
+
'convert.in->mm',
|
|
34218
|
+
'convert.in->cm',
|
|
34219
|
+
'convert.in->m',
|
|
34220
|
+
'convert.in->km',
|
|
34221
|
+
'convert.in->ft',
|
|
34222
|
+
'convert.in->yd',
|
|
34223
|
+
'convert.in->mi',
|
|
34224
|
+
'convert.in->nmi',
|
|
34225
|
+
'convert.ft->angstrom',
|
|
34226
|
+
'convert.ft->um',
|
|
34227
|
+
'convert.ft->mm',
|
|
34228
|
+
'convert.ft->cm',
|
|
34229
|
+
'convert.ft->m',
|
|
34230
|
+
'convert.ft->km',
|
|
34231
|
+
'convert.ft->in',
|
|
34232
|
+
'convert.ft->yd',
|
|
34233
|
+
'convert.ft->mi',
|
|
34234
|
+
'convert.ft->nmi',
|
|
34235
|
+
'convert.yd->angstrom',
|
|
34236
|
+
'convert.yd->um',
|
|
34237
|
+
'convert.yd->mm',
|
|
34238
|
+
'convert.yd->cm',
|
|
34239
|
+
'convert.yd->m',
|
|
34240
|
+
'convert.yd->km',
|
|
34241
|
+
'convert.yd->in',
|
|
34242
|
+
'convert.yd->ft',
|
|
34243
|
+
'convert.yd->mi',
|
|
34244
|
+
'convert.yd->nmi',
|
|
34245
|
+
'convert.mi->angstrom',
|
|
34246
|
+
'convert.mi->um',
|
|
34247
|
+
'convert.mi->mm',
|
|
34248
|
+
'convert.mi->cm',
|
|
34249
|
+
'convert.mi->m',
|
|
34250
|
+
'convert.mi->km',
|
|
34251
|
+
'convert.mi->in',
|
|
34252
|
+
'convert.mi->ft',
|
|
34253
|
+
'convert.mi->yd',
|
|
34254
|
+
'convert.mi->nmi',
|
|
34255
|
+
'convert.nmi->angstrom',
|
|
34256
|
+
'convert.nmi->um',
|
|
34257
|
+
'convert.nmi->mm',
|
|
34258
|
+
'convert.nmi->cm',
|
|
34259
|
+
'convert.nmi->m',
|
|
34260
|
+
'convert.nmi->km',
|
|
34261
|
+
'convert.nmi->in',
|
|
34262
|
+
'convert.nmi->ft',
|
|
34263
|
+
'convert.nmi->yd',
|
|
34264
|
+
'convert.nmi->mi',
|
|
34265
|
+
'convert.mg->g',
|
|
34266
|
+
'convert.mg->kg',
|
|
34267
|
+
'convert.mg->t',
|
|
34268
|
+
'convert.mg->oz',
|
|
34269
|
+
'convert.mg->lb',
|
|
34270
|
+
'convert.mg->st',
|
|
34271
|
+
'convert.g->mg',
|
|
34272
|
+
'convert.g->kg',
|
|
34273
|
+
'convert.g->t',
|
|
34274
|
+
'convert.g->oz',
|
|
34275
|
+
'convert.g->lb',
|
|
34276
|
+
'convert.g->st',
|
|
34277
|
+
'convert.kg->mg',
|
|
34278
|
+
'convert.kg->g',
|
|
34279
|
+
'convert.kg->t',
|
|
34280
|
+
'convert.kg->oz',
|
|
34281
|
+
'convert.kg->lb',
|
|
34282
|
+
'convert.kg->st',
|
|
34283
|
+
'convert.t->mg',
|
|
34284
|
+
'convert.t->g',
|
|
34285
|
+
'convert.t->kg',
|
|
34286
|
+
'convert.t->oz',
|
|
34287
|
+
'convert.t->lb',
|
|
34288
|
+
'convert.t->st',
|
|
34289
|
+
'convert.oz->mg',
|
|
34290
|
+
'convert.oz->g',
|
|
34291
|
+
'convert.oz->kg',
|
|
34292
|
+
'convert.oz->t',
|
|
34293
|
+
'convert.oz->lb',
|
|
34294
|
+
'convert.oz->st',
|
|
34295
|
+
'convert.lb->mg',
|
|
34296
|
+
'convert.lb->g',
|
|
34297
|
+
'convert.lb->kg',
|
|
34298
|
+
'convert.lb->t',
|
|
34299
|
+
'convert.lb->oz',
|
|
34300
|
+
'convert.lb->st',
|
|
34301
|
+
'convert.st->mg',
|
|
34302
|
+
'convert.st->g',
|
|
34303
|
+
'convert.st->kg',
|
|
34304
|
+
'convert.st->t',
|
|
34305
|
+
'convert.st->oz',
|
|
34306
|
+
'convert.st->lb',
|
|
34307
|
+
'convert.ml->cl',
|
|
34308
|
+
'convert.ml->dl',
|
|
34309
|
+
'convert.ml->l',
|
|
34310
|
+
'convert.ml->tsp',
|
|
34311
|
+
'convert.ml->tbsp',
|
|
34312
|
+
'convert.ml->fl-oz',
|
|
34313
|
+
'convert.ml->cup',
|
|
34314
|
+
'convert.ml->pt',
|
|
34315
|
+
'convert.ml->qt',
|
|
34316
|
+
'convert.ml->gal',
|
|
34317
|
+
'convert.cl->ml',
|
|
34318
|
+
'convert.cl->dl',
|
|
34319
|
+
'convert.cl->l',
|
|
34320
|
+
'convert.cl->tsp',
|
|
34321
|
+
'convert.cl->tbsp',
|
|
34322
|
+
'convert.cl->fl-oz',
|
|
34323
|
+
'convert.cl->cup',
|
|
34324
|
+
'convert.cl->pt',
|
|
34325
|
+
'convert.cl->qt',
|
|
34326
|
+
'convert.cl->gal',
|
|
34327
|
+
'convert.dl->ml',
|
|
34328
|
+
'convert.dl->cl',
|
|
34329
|
+
'convert.dl->l',
|
|
34330
|
+
'convert.dl->tsp',
|
|
34331
|
+
'convert.dl->tbsp',
|
|
34332
|
+
'convert.dl->fl-oz',
|
|
34333
|
+
'convert.dl->cup',
|
|
34334
|
+
'convert.dl->pt',
|
|
34335
|
+
'convert.dl->qt',
|
|
34336
|
+
'convert.dl->gal',
|
|
34337
|
+
'convert.l->ml',
|
|
34338
|
+
'convert.l->cl',
|
|
34339
|
+
'convert.l->dl',
|
|
34340
|
+
'convert.l->tsp',
|
|
34341
|
+
'convert.l->tbsp',
|
|
34342
|
+
'convert.l->fl-oz',
|
|
34343
|
+
'convert.l->cup',
|
|
34344
|
+
'convert.l->pt',
|
|
34345
|
+
'convert.l->qt',
|
|
34346
|
+
'convert.l->gal',
|
|
34347
|
+
'convert.tsp->ml',
|
|
34348
|
+
'convert.tsp->cl',
|
|
34349
|
+
'convert.tsp->dl',
|
|
34350
|
+
'convert.tsp->l',
|
|
34351
|
+
'convert.tsp->tbsp',
|
|
34352
|
+
'convert.tsp->fl-oz',
|
|
34353
|
+
'convert.tsp->cup',
|
|
34354
|
+
'convert.tsp->pt',
|
|
34355
|
+
'convert.tsp->qt',
|
|
34356
|
+
'convert.tsp->gal',
|
|
34357
|
+
'convert.tbsp->ml',
|
|
34358
|
+
'convert.tbsp->cl',
|
|
34359
|
+
'convert.tbsp->dl',
|
|
34360
|
+
'convert.tbsp->l',
|
|
34361
|
+
'convert.tbsp->tsp',
|
|
34362
|
+
'convert.tbsp->fl-oz',
|
|
34363
|
+
'convert.tbsp->cup',
|
|
34364
|
+
'convert.tbsp->pt',
|
|
34365
|
+
'convert.tbsp->qt',
|
|
34366
|
+
'convert.tbsp->gal',
|
|
34367
|
+
'convert.fl-oz->ml',
|
|
34368
|
+
'convert.fl-oz->cl',
|
|
34369
|
+
'convert.fl-oz->dl',
|
|
34370
|
+
'convert.fl-oz->l',
|
|
34371
|
+
'convert.fl-oz->tsp',
|
|
34372
|
+
'convert.fl-oz->tbsp',
|
|
34373
|
+
'convert.fl-oz->cup',
|
|
34374
|
+
'convert.fl-oz->pt',
|
|
34375
|
+
'convert.fl-oz->qt',
|
|
34376
|
+
'convert.fl-oz->gal',
|
|
34377
|
+
'convert.cup->ml',
|
|
34378
|
+
'convert.cup->cl',
|
|
34379
|
+
'convert.cup->dl',
|
|
34380
|
+
'convert.cup->l',
|
|
34381
|
+
'convert.cup->tsp',
|
|
34382
|
+
'convert.cup->tbsp',
|
|
34383
|
+
'convert.cup->fl-oz',
|
|
34384
|
+
'convert.cup->pt',
|
|
34385
|
+
'convert.cup->qt',
|
|
34386
|
+
'convert.cup->gal',
|
|
34387
|
+
'convert.pt->ml',
|
|
34388
|
+
'convert.pt->cl',
|
|
34389
|
+
'convert.pt->dl',
|
|
34390
|
+
'convert.pt->l',
|
|
34391
|
+
'convert.pt->tsp',
|
|
34392
|
+
'convert.pt->tbsp',
|
|
34393
|
+
'convert.pt->fl-oz',
|
|
34394
|
+
'convert.pt->cup',
|
|
34395
|
+
'convert.pt->qt',
|
|
34396
|
+
'convert.pt->gal',
|
|
34397
|
+
'convert.qt->ml',
|
|
34398
|
+
'convert.qt->cl',
|
|
34399
|
+
'convert.qt->dl',
|
|
34400
|
+
'convert.qt->l',
|
|
34401
|
+
'convert.qt->tsp',
|
|
34402
|
+
'convert.qt->tbsp',
|
|
34403
|
+
'convert.qt->fl-oz',
|
|
34404
|
+
'convert.qt->cup',
|
|
34405
|
+
'convert.qt->pt',
|
|
34406
|
+
'convert.qt->gal',
|
|
34407
|
+
'convert.gal->ml',
|
|
34408
|
+
'convert.gal->cl',
|
|
34409
|
+
'convert.gal->dl',
|
|
34410
|
+
'convert.gal->l',
|
|
34411
|
+
'convert.gal->tsp',
|
|
34412
|
+
'convert.gal->tbsp',
|
|
34413
|
+
'convert.gal->fl-oz',
|
|
34414
|
+
'convert.gal->cup',
|
|
34415
|
+
'convert.gal->pt',
|
|
34416
|
+
'convert.gal->qt',
|
|
34417
|
+
'convert.ms->s',
|
|
34418
|
+
'convert.ms->min',
|
|
34419
|
+
'convert.ms->h',
|
|
34420
|
+
'convert.ms->day',
|
|
34421
|
+
'convert.ms->week',
|
|
34422
|
+
'convert.s->ms',
|
|
34423
|
+
'convert.s->min',
|
|
34424
|
+
'convert.s->h',
|
|
34425
|
+
'convert.s->day',
|
|
34426
|
+
'convert.s->week',
|
|
34427
|
+
'convert.min->ms',
|
|
34428
|
+
'convert.min->s',
|
|
34429
|
+
'convert.min->h',
|
|
34430
|
+
'convert.min->day',
|
|
34431
|
+
'convert.min->week',
|
|
34432
|
+
'convert.h->ms',
|
|
34433
|
+
'convert.h->s',
|
|
34434
|
+
'convert.h->min',
|
|
34435
|
+
'convert.h->day',
|
|
34436
|
+
'convert.h->week',
|
|
34437
|
+
'convert.day->ms',
|
|
34438
|
+
'convert.day->s',
|
|
34439
|
+
'convert.day->min',
|
|
34440
|
+
'convert.day->h',
|
|
34441
|
+
'convert.day->week',
|
|
34442
|
+
'convert.week->ms',
|
|
34443
|
+
'convert.week->s',
|
|
34444
|
+
'convert.week->min',
|
|
34445
|
+
'convert.week->h',
|
|
34446
|
+
'convert.week->day',
|
|
34447
|
+
'convert.mm2->cm2',
|
|
34448
|
+
'convert.mm2->m2',
|
|
34449
|
+
'convert.mm2->km2',
|
|
34450
|
+
'convert.mm2->in2',
|
|
34451
|
+
'convert.mm2->ft2',
|
|
34452
|
+
'convert.mm2->yd2',
|
|
34453
|
+
'convert.mm2->acre',
|
|
34454
|
+
'convert.mm2->hectare',
|
|
34455
|
+
'convert.cm2->mm2',
|
|
34456
|
+
'convert.cm2->m2',
|
|
34457
|
+
'convert.cm2->km2',
|
|
34458
|
+
'convert.cm2->in2',
|
|
34459
|
+
'convert.cm2->ft2',
|
|
34460
|
+
'convert.cm2->yd2',
|
|
34461
|
+
'convert.cm2->acre',
|
|
34462
|
+
'convert.cm2->hectare',
|
|
34463
|
+
'convert.m2->mm2',
|
|
34464
|
+
'convert.m2->cm2',
|
|
34465
|
+
'convert.m2->km2',
|
|
34466
|
+
'convert.m2->in2',
|
|
34467
|
+
'convert.m2->ft2',
|
|
34468
|
+
'convert.m2->yd2',
|
|
34469
|
+
'convert.m2->acre',
|
|
34470
|
+
'convert.m2->hectare',
|
|
34471
|
+
'convert.km2->mm2',
|
|
34472
|
+
'convert.km2->cm2',
|
|
34473
|
+
'convert.km2->m2',
|
|
34474
|
+
'convert.km2->in2',
|
|
34475
|
+
'convert.km2->ft2',
|
|
34476
|
+
'convert.km2->yd2',
|
|
34477
|
+
'convert.km2->acre',
|
|
34478
|
+
'convert.km2->hectare',
|
|
34479
|
+
'convert.in2->mm2',
|
|
34480
|
+
'convert.in2->cm2',
|
|
34481
|
+
'convert.in2->m2',
|
|
34482
|
+
'convert.in2->km2',
|
|
34483
|
+
'convert.in2->ft2',
|
|
34484
|
+
'convert.in2->yd2',
|
|
34485
|
+
'convert.in2->acre',
|
|
34486
|
+
'convert.in2->hectare',
|
|
34487
|
+
'convert.ft2->mm2',
|
|
34488
|
+
'convert.ft2->cm2',
|
|
34489
|
+
'convert.ft2->m2',
|
|
34490
|
+
'convert.ft2->km2',
|
|
34491
|
+
'convert.ft2->in2',
|
|
34492
|
+
'convert.ft2->yd2',
|
|
34493
|
+
'convert.ft2->acre',
|
|
34494
|
+
'convert.ft2->hectare',
|
|
34495
|
+
'convert.yd2->mm2',
|
|
34496
|
+
'convert.yd2->cm2',
|
|
34497
|
+
'convert.yd2->m2',
|
|
34498
|
+
'convert.yd2->km2',
|
|
34499
|
+
'convert.yd2->in2',
|
|
34500
|
+
'convert.yd2->ft2',
|
|
34501
|
+
'convert.yd2->acre',
|
|
34502
|
+
'convert.yd2->hectare',
|
|
34503
|
+
'convert.acre->mm2',
|
|
34504
|
+
'convert.acre->cm2',
|
|
34505
|
+
'convert.acre->m2',
|
|
34506
|
+
'convert.acre->km2',
|
|
34507
|
+
'convert.acre->in2',
|
|
34508
|
+
'convert.acre->ft2',
|
|
34509
|
+
'convert.acre->yd2',
|
|
34510
|
+
'convert.acre->hectare',
|
|
34511
|
+
'convert.hectare->mm2',
|
|
34512
|
+
'convert.hectare->cm2',
|
|
34513
|
+
'convert.hectare->m2',
|
|
34514
|
+
'convert.hectare->km2',
|
|
34515
|
+
'convert.hectare->in2',
|
|
34516
|
+
'convert.hectare->ft2',
|
|
34517
|
+
'convert.hectare->yd2',
|
|
34518
|
+
'convert.hectare->acre',
|
|
34519
|
+
'convert.m/s->km/h',
|
|
34520
|
+
'convert.m/s->mph',
|
|
34521
|
+
'convert.m/s->kn',
|
|
34522
|
+
'convert.m/s->ft/s',
|
|
34523
|
+
'convert.km/h->m/s',
|
|
34524
|
+
'convert.km/h->mph',
|
|
34525
|
+
'convert.km/h->kn',
|
|
34526
|
+
'convert.km/h->ft/s',
|
|
34527
|
+
'convert.mph->m/s',
|
|
34528
|
+
'convert.mph->km/h',
|
|
34529
|
+
'convert.mph->kn',
|
|
34530
|
+
'convert.mph->ft/s',
|
|
34531
|
+
'convert.kn->m/s',
|
|
34532
|
+
'convert.kn->km/h',
|
|
34533
|
+
'convert.kn->mph',
|
|
34534
|
+
'convert.kn->ft/s',
|
|
34535
|
+
'convert.ft/s->m/s',
|
|
34536
|
+
'convert.ft/s->km/h',
|
|
34537
|
+
'convert.ft/s->mph',
|
|
34538
|
+
'convert.ft/s->kn',
|
|
34539
|
+
'convert.b->kb',
|
|
34540
|
+
'convert.b->mb',
|
|
34541
|
+
'convert.b->gb',
|
|
34542
|
+
'convert.b->tb',
|
|
34543
|
+
'convert.b->pb',
|
|
34544
|
+
'convert.kb->b',
|
|
34545
|
+
'convert.kb->mb',
|
|
34546
|
+
'convert.kb->gb',
|
|
34547
|
+
'convert.kb->tb',
|
|
34548
|
+
'convert.kb->pb',
|
|
34549
|
+
'convert.mb->b',
|
|
34550
|
+
'convert.mb->kb',
|
|
34551
|
+
'convert.mb->gb',
|
|
34552
|
+
'convert.mb->tb',
|
|
34553
|
+
'convert.mb->pb',
|
|
34554
|
+
'convert.gb->b',
|
|
34555
|
+
'convert.gb->kb',
|
|
34556
|
+
'convert.gb->mb',
|
|
34557
|
+
'convert.gb->tb',
|
|
34558
|
+
'convert.gb->pb',
|
|
34559
|
+
'convert.tb->b',
|
|
34560
|
+
'convert.tb->kb',
|
|
34561
|
+
'convert.tb->mb',
|
|
34562
|
+
'convert.tb->gb',
|
|
34563
|
+
'convert.tb->pb',
|
|
34564
|
+
'convert.pb->b',
|
|
34565
|
+
'convert.pb->kb',
|
|
34566
|
+
'convert.pb->mb',
|
|
34567
|
+
'convert.pb->gb',
|
|
34568
|
+
'convert.pb->tb',
|
|
34569
|
+
'convert.pa->kpa',
|
|
34570
|
+
'convert.pa->bar',
|
|
34571
|
+
'convert.pa->atm',
|
|
34572
|
+
'convert.pa->psi',
|
|
34573
|
+
'convert.pa->mmhg',
|
|
34574
|
+
'convert.kpa->pa',
|
|
34575
|
+
'convert.kpa->bar',
|
|
34576
|
+
'convert.kpa->atm',
|
|
34577
|
+
'convert.kpa->psi',
|
|
34578
|
+
'convert.kpa->mmhg',
|
|
34579
|
+
'convert.bar->pa',
|
|
34580
|
+
'convert.bar->kpa',
|
|
34581
|
+
'convert.bar->atm',
|
|
34582
|
+
'convert.bar->psi',
|
|
34583
|
+
'convert.bar->mmhg',
|
|
34584
|
+
'convert.atm->pa',
|
|
34585
|
+
'convert.atm->kpa',
|
|
34586
|
+
'convert.atm->bar',
|
|
34587
|
+
'convert.atm->psi',
|
|
34588
|
+
'convert.atm->mmhg',
|
|
34589
|
+
'convert.psi->pa',
|
|
34590
|
+
'convert.psi->kpa',
|
|
34591
|
+
'convert.psi->bar',
|
|
34592
|
+
'convert.psi->atm',
|
|
34593
|
+
'convert.psi->mmhg',
|
|
34594
|
+
'convert.mmhg->pa',
|
|
34595
|
+
'convert.mmhg->kpa',
|
|
34596
|
+
'convert.mmhg->bar',
|
|
34597
|
+
'convert.mmhg->atm',
|
|
34598
|
+
'convert.mmhg->psi',
|
|
34599
|
+
'convert.j->kj',
|
|
34600
|
+
'convert.j->cal',
|
|
34601
|
+
'convert.j->kcal',
|
|
34602
|
+
'convert.j->wh',
|
|
34603
|
+
'convert.j->kwh',
|
|
34604
|
+
'convert.j->btu',
|
|
34605
|
+
'convert.kj->j',
|
|
34606
|
+
'convert.kj->cal',
|
|
34607
|
+
'convert.kj->kcal',
|
|
34608
|
+
'convert.kj->wh',
|
|
34609
|
+
'convert.kj->kwh',
|
|
34610
|
+
'convert.kj->btu',
|
|
34611
|
+
'convert.cal->j',
|
|
34612
|
+
'convert.cal->kj',
|
|
34613
|
+
'convert.cal->kcal',
|
|
34614
|
+
'convert.cal->wh',
|
|
34615
|
+
'convert.cal->kwh',
|
|
34616
|
+
'convert.cal->btu',
|
|
34617
|
+
'convert.kcal->j',
|
|
34618
|
+
'convert.kcal->kj',
|
|
34619
|
+
'convert.kcal->cal',
|
|
34620
|
+
'convert.kcal->wh',
|
|
34621
|
+
'convert.kcal->kwh',
|
|
34622
|
+
'convert.kcal->btu',
|
|
34623
|
+
'convert.wh->j',
|
|
34624
|
+
'convert.wh->kj',
|
|
34625
|
+
'convert.wh->cal',
|
|
34626
|
+
'convert.wh->kcal',
|
|
34627
|
+
'convert.wh->kwh',
|
|
34628
|
+
'convert.wh->btu',
|
|
34629
|
+
'convert.kwh->j',
|
|
34630
|
+
'convert.kwh->kj',
|
|
34631
|
+
'convert.kwh->cal',
|
|
34632
|
+
'convert.kwh->kcal',
|
|
34633
|
+
'convert.kwh->wh',
|
|
34634
|
+
'convert.kwh->btu',
|
|
34635
|
+
'convert.btu->j',
|
|
34636
|
+
'convert.btu->kj',
|
|
34637
|
+
'convert.btu->cal',
|
|
34638
|
+
'convert.btu->kcal',
|
|
34639
|
+
'convert.btu->wh',
|
|
34640
|
+
'convert.btu->kwh',
|
|
34641
|
+
'convert.w->kw',
|
|
34642
|
+
'convert.w->mw',
|
|
34643
|
+
'convert.w->hp',
|
|
34644
|
+
'convert.kw->w',
|
|
34645
|
+
'convert.kw->mw',
|
|
34646
|
+
'convert.kw->hp',
|
|
34647
|
+
'convert.mw->w',
|
|
34648
|
+
'convert.mw->kw',
|
|
34649
|
+
'convert.mw->hp',
|
|
34650
|
+
'convert.hp->w',
|
|
34651
|
+
'convert.hp->kw',
|
|
34652
|
+
'convert.hp->mw',
|
|
34653
|
+
'convert.hz->khz',
|
|
34654
|
+
'convert.hz->mhz',
|
|
34655
|
+
'convert.hz->ghz',
|
|
34656
|
+
'convert.khz->hz',
|
|
34657
|
+
'convert.khz->mhz',
|
|
34658
|
+
'convert.khz->ghz',
|
|
34659
|
+
'convert.mhz->hz',
|
|
34660
|
+
'convert.mhz->khz',
|
|
34661
|
+
'convert.mhz->ghz',
|
|
34662
|
+
'convert.ghz->hz',
|
|
34663
|
+
'convert.ghz->khz',
|
|
34664
|
+
'convert.ghz->mhz',
|
|
34665
|
+
'convert.deg->rad',
|
|
34666
|
+
'convert.deg->grad',
|
|
34667
|
+
'convert.deg->turn',
|
|
34668
|
+
'convert.rad->deg',
|
|
34669
|
+
'convert.rad->grad',
|
|
34670
|
+
'convert.rad->turn',
|
|
34671
|
+
'convert.grad->deg',
|
|
34672
|
+
'convert.grad->rad',
|
|
34673
|
+
'convert.grad->turn',
|
|
34674
|
+
'convert.turn->deg',
|
|
34675
|
+
'convert.turn->rad',
|
|
34676
|
+
'convert.turn->grad',
|
|
34677
|
+
'convert.c->f',
|
|
34678
|
+
'convert.c->k',
|
|
34679
|
+
'convert.f->c',
|
|
34680
|
+
'convert.f->k',
|
|
34681
|
+
'convert.k->c',
|
|
34682
|
+
'convert.k->f',
|
|
34683
|
+
],
|
|
33737
34684
|
shorthand: [
|
|
33738
34685
|
'-short-regexp',
|
|
33739
34686
|
'-short-fn',
|
|
@@ -33772,6 +34719,7 @@ const coreApiFunctionNames = [
|
|
|
33772
34719
|
...api.string,
|
|
33773
34720
|
...api.bitwise,
|
|
33774
34721
|
...api.vector,
|
|
34722
|
+
...api.assertion,
|
|
33775
34723
|
];
|
|
33776
34724
|
// Core API names (core functions + shorthand + datatype)
|
|
33777
34725
|
const coreApiNames = [
|