@mojir/lits 2.5.0 → 2.5.2
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 +4 -5
- package/dist/cli/cli.js +1432 -705
- package/dist/cli/reference/api.d.ts +8 -6
- package/dist/cli/reference/index.d.ts +132 -132
- package/dist/cli/src/builtin/interface.d.ts +1 -0
- package/dist/cli/src/builtin/modules/convert/index.d.ts +2 -0
- 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/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 +8 -6
- package/dist/modules/reference/index.d.ts +132 -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/interface.d.ts +1 -0
- package/dist/modules/src/builtin/modules/convert/index.d.ts +2 -0
- package/dist/modules/src/modules/convert.d.ts +2 -0
- 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 +8 -6
- package/dist/reference/index.d.ts +132 -132
- package/dist/src/builtin/interface.d.ts +1 -0
- package/dist/src/builtin/modules/convert/index.d.ts +2 -0
- package/dist/src/modules/convert.d.ts +2 -0
- 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 +6 -1
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.5.
|
|
10
|
+
var version = "2.5.2";
|
|
11
11
|
|
|
12
12
|
function getCodeMarker(sourceCodeInfo) {
|
|
13
13
|
if (!sourceCodeInfo.position || !sourceCodeInfo.code)
|
|
@@ -1224,7 +1224,7 @@ filter(
|
|
|
1224
1224
|
},
|
|
1225
1225
|
variants: [{ argumentNames: ['colls', 'fun'] }],
|
|
1226
1226
|
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'],
|
|
1227
|
+
seeAlso: ['collection.mapi', 'filter', 'reduce', 'mapcat', 'grid.cell-map', 'grid.cell-mapi'],
|
|
1228
1228
|
examples: [
|
|
1229
1229
|
'[1, 2, 3] map -',
|
|
1230
1230
|
'[1, 2, 3] map -> -($)',
|
|
@@ -1275,7 +1275,7 @@ filter(
|
|
|
1275
1275
|
},
|
|
1276
1276
|
variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],
|
|
1277
1277
|
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'],
|
|
1278
|
+
seeAlso: ['collection.reduce-right', 'collection.reducei', 'collection.reductions', 'map', 'grid.cell-reduce', 'grid.cell-reducei'],
|
|
1279
1279
|
examples: [
|
|
1280
1280
|
'reduce([1, 2, 3], +, 0)',
|
|
1281
1281
|
'reduce([], +, 0)',
|
|
@@ -1655,7 +1655,7 @@ range(
|
|
|
1655
1655
|
},
|
|
1656
1656
|
variants: [{ argumentNames: ['a', 'b'] }],
|
|
1657
1657
|
description: 'Returns an array with $a repeated $b times.',
|
|
1658
|
-
seeAlso: ['range', '
|
|
1658
|
+
seeAlso: ['range', 'string.string-repeat'],
|
|
1659
1659
|
examples: [
|
|
1660
1660
|
'repeat(10, 3)',
|
|
1661
1661
|
'repeat(10, 0)',
|
|
@@ -1904,7 +1904,7 @@ const sequenceNormalExpression = {
|
|
|
1904
1904
|
args: { seq: { type: 'sequence' } },
|
|
1905
1905
|
variants: [{ argumentNames: ['seq'] }],
|
|
1906
1906
|
description: 'Returns a copy of $seq with last element removed. If $seq is empty `null` is returned.',
|
|
1907
|
-
seeAlso: ['push', '
|
|
1907
|
+
seeAlso: ['push', 'last'],
|
|
1908
1908
|
examples: [
|
|
1909
1909
|
'pop([1, 2, 3])',
|
|
1910
1910
|
'pop([])',
|
|
@@ -2004,7 +2004,7 @@ l`,
|
|
|
2004
2004
|
description: `If $seq is an array, returns a new array with all but the first element from $seq.
|
|
2005
2005
|
If $seq has less than two elements, an empty array is returned.
|
|
2006
2006
|
For string $seq returns all but the first characters in $seq.`,
|
|
2007
|
-
seeAlso: ['next', 'first'
|
|
2007
|
+
seeAlso: ['next', 'first'],
|
|
2008
2008
|
examples: [
|
|
2009
2009
|
'rest(["Albert", "Mojir", 160, [1, 2]])',
|
|
2010
2010
|
'rest(["Albert"])',
|
|
@@ -5183,7 +5183,7 @@ let add = (x, y) -> do
|
|
|
5183
5183
|
y: Second number.
|
|
5184
5184
|
Returns:
|
|
5185
5185
|
Sum of x and y.
|
|
5186
|
-
"""
|
|
5186
|
+
""";
|
|
5187
5187
|
x + y;
|
|
5188
5188
|
end;
|
|
5189
5189
|
|
|
@@ -5246,7 +5246,7 @@ const vectorNormalExpression = {
|
|
|
5246
5246
|
},
|
|
5247
5247
|
variants: [{ argumentNames: ['vector'] }],
|
|
5248
5248
|
description: 'Returns the **sum** of all elements in the `vector`. Returns `0` for an empty vector.',
|
|
5249
|
-
seeAlso: ['prod', 'mean', 'median', 'vector.sum'],
|
|
5249
|
+
seeAlso: ['prod', 'mean', 'median', 'vector.moving-sum', 'vector.centered-moving-sum', 'vector.running-sum', 'vector.cumsum'],
|
|
5250
5250
|
examples: [
|
|
5251
5251
|
'sum([1, 2, 3, 4, 5])',
|
|
5252
5252
|
'sum([1, -2, 3])',
|
|
@@ -5268,7 +5268,7 @@ const vectorNormalExpression = {
|
|
|
5268
5268
|
},
|
|
5269
5269
|
variants: [{ argumentNames: ['vector'] }],
|
|
5270
5270
|
description: 'Returns the **product** of all elements in the `vector`. Returns `1` for an empty vector.',
|
|
5271
|
-
seeAlso: ['sum', 'mean', 'median', 'vector.prod'],
|
|
5271
|
+
seeAlso: ['sum', 'mean', 'median', 'vector.moving-prod', 'vector.centered-moving-prod', 'vector.running-prod', 'vector.cumprod'],
|
|
5272
5272
|
examples: [
|
|
5273
5273
|
'prod([1, 2, 3, 4, 5])',
|
|
5274
5274
|
'prod([1, -2, 3])',
|
|
@@ -5290,7 +5290,7 @@ const vectorNormalExpression = {
|
|
|
5290
5290
|
},
|
|
5291
5291
|
variants: [{ argumentNames: ['vector'] }],
|
|
5292
5292
|
description: 'Returns the arithmetic **mean** of all elements in the `vector`. Throws for an empty vector.',
|
|
5293
|
-
seeAlso: ['median', 'sum', 'prod', 'vector.mean'],
|
|
5293
|
+
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
5294
|
examples: [
|
|
5295
5295
|
'mean([1, 2, 3, 4, 5])',
|
|
5296
5296
|
'mean([1, -2, 3])',
|
|
@@ -5311,7 +5311,7 @@ const vectorNormalExpression = {
|
|
|
5311
5311
|
},
|
|
5312
5312
|
variants: [{ argumentNames: ['vector'] }],
|
|
5313
5313
|
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'],
|
|
5314
|
+
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
5315
|
examples: [
|
|
5316
5316
|
'median([1, 2, 3, 4, 5])',
|
|
5317
5317
|
'median([1, 2, 3, 4])',
|
|
@@ -6639,8 +6639,8 @@ const docs = {
|
|
|
6639
6639
|
],
|
|
6640
6640
|
returns: { type: 'object' },
|
|
6641
6641
|
examples: [
|
|
6642
|
-
'let v = import(vector); v.
|
|
6643
|
-
'let {
|
|
6642
|
+
'let v = import(vector); v.stdev([1, 2, 3, 4])',
|
|
6643
|
+
'let { linspace } = import(vector); linspace(0, 10, 5)',
|
|
6644
6644
|
'let g = import(grid); g.row([[1, 2], [3, 4]], 0)',
|
|
6645
6645
|
],
|
|
6646
6646
|
};
|
|
@@ -8448,6 +8448,10 @@ function parseDo(ctx, allowDocString = false) {
|
|
|
8448
8448
|
let docString = '';
|
|
8449
8449
|
if (allowDocString && isDocStringToken(ctx.tryPeek())) {
|
|
8450
8450
|
docString = parseDocString(ctx);
|
|
8451
|
+
if (!ctx.isAtEnd() && !isReservedSymbolToken(ctx.tryPeek(), 'end')) {
|
|
8452
|
+
assertOperatorToken(ctx.tryPeek(), ';');
|
|
8453
|
+
ctx.advance();
|
|
8454
|
+
}
|
|
8451
8455
|
}
|
|
8452
8456
|
const expressions = [];
|
|
8453
8457
|
while (!ctx.isAtEnd() && !isReservedSymbolToken(ctx.tryPeek(), 'end')) {
|
|
@@ -10969,7 +10973,7 @@ const assertModule = {
|
|
|
10969
10973
|
};
|
|
10970
10974
|
|
|
10971
10975
|
const moduleDocs$5 = {
|
|
10972
|
-
'every?': {
|
|
10976
|
+
'cell-every?': {
|
|
10973
10977
|
category: 'grid',
|
|
10974
10978
|
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
10979
|
returns: {
|
|
@@ -10992,9 +10996,9 @@ const moduleDocs$5 = {
|
|
|
10992
10996
|
},
|
|
10993
10997
|
],
|
|
10994
10998
|
examples: [
|
|
10995
|
-
'
|
|
10996
|
-
'
|
|
10997
|
-
'
|
|
10999
|
+
'let { cell-every? } = import(grid);\ncell-every?([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], string?)',
|
|
11000
|
+
'let { cell-every? } = import(grid);\ncell-every?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], string?)',
|
|
11001
|
+
'let { cell-every? } = import(grid);\ncell-every?([\n [1, 2],\n [3, 4],\n], string?)',
|
|
10998
11002
|
],
|
|
10999
11003
|
seeAlso: ['collection.every?', 'grid.some?', 'grid.every-row?', 'grid.every-col?'],
|
|
11000
11004
|
},
|
|
@@ -11025,7 +11029,7 @@ const moduleDocs$5 = {
|
|
|
11025
11029
|
'let { some? } = import(grid);\nsome?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], string?)',
|
|
11026
11030
|
'let { some? } = import(grid);\nsome?([\n [1, 2],\n [3, 4],\n], string?)',
|
|
11027
11031
|
],
|
|
11028
|
-
seeAlso: ['collection.any?', 'grid.every?', 'grid.some-row?', 'grid.some-col?'],
|
|
11032
|
+
seeAlso: ['collection.any?', 'grid.cell-every?', 'grid.some-row?', 'grid.some-col?'],
|
|
11029
11033
|
},
|
|
11030
11034
|
'every-row?': {
|
|
11031
11035
|
category: 'grid',
|
|
@@ -11054,7 +11058,7 @@ const moduleDocs$5 = {
|
|
|
11054
11058
|
'let { every-row? } = import(grid);\nevery-row?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], -> string?($[0]))',
|
|
11055
11059
|
'let { every-row? } = import(grid);\nevery-row?([\n [1, 2],\n [3, 4],\n], -> string?($[0]))',
|
|
11056
11060
|
],
|
|
11057
|
-
seeAlso: ['grid.some-row?', 'grid.every-col?', 'grid.every?'],
|
|
11061
|
+
seeAlso: ['grid.some-row?', 'grid.every-col?', 'grid.cell-every?'],
|
|
11058
11062
|
},
|
|
11059
11063
|
'some-row?': {
|
|
11060
11064
|
category: 'grid',
|
|
@@ -11112,7 +11116,7 @@ const moduleDocs$5 = {
|
|
|
11112
11116
|
'let { every-col? } = import(grid);\nevery-col?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], -> string?($[0]))',
|
|
11113
11117
|
'let { every-col? } = import(grid);\nevery-col?([\n [1, 2],\n [3, 4],\n], -> string?($[0]))',
|
|
11114
11118
|
],
|
|
11115
|
-
seeAlso: ['grid.some-col?', 'grid.every-row?', 'grid.every?'],
|
|
11119
|
+
seeAlso: ['grid.some-col?', 'grid.every-row?', 'grid.cell-every?'],
|
|
11116
11120
|
},
|
|
11117
11121
|
'some-col?': {
|
|
11118
11122
|
category: 'grid',
|
|
@@ -11260,7 +11264,7 @@ const moduleDocs$5 = {
|
|
|
11260
11264
|
'let { fill } = import(grid);\nfill(2, 3, 0)',
|
|
11261
11265
|
'let { fill } = import(grid);\nfill(2, 3, "x")',
|
|
11262
11266
|
],
|
|
11263
|
-
seeAlso: ['grid.generate', 'grid.from-array'
|
|
11267
|
+
seeAlso: ['grid.generate', 'grid.from-array'],
|
|
11264
11268
|
},
|
|
11265
11269
|
'generate': {
|
|
11266
11270
|
category: 'grid',
|
|
@@ -11294,7 +11298,7 @@ const moduleDocs$5 = {
|
|
|
11294
11298
|
examples: [
|
|
11295
11299
|
'let { generate } = import(grid);\ngenerate(3, 3, (i, j) -> i + j)',
|
|
11296
11300
|
],
|
|
11297
|
-
seeAlso: ['grid.fill', 'grid.from-array'
|
|
11301
|
+
seeAlso: ['grid.fill', 'grid.from-array'],
|
|
11298
11302
|
},
|
|
11299
11303
|
'reshape': {
|
|
11300
11304
|
category: 'grid',
|
|
@@ -11373,7 +11377,7 @@ const moduleDocs$5 = {
|
|
|
11373
11377
|
'let { flip-h } = import(grid);\nflip-h([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n])',
|
|
11374
11378
|
'let { flip-h } = import(grid);\nflip-h([\n [1, 2],\n [3, 4],\n])',
|
|
11375
11379
|
],
|
|
11376
|
-
seeAlso: ['grid.flip-v', 'grid.transpose', 'grid.rotate'
|
|
11380
|
+
seeAlso: ['grid.flip-v', 'grid.transpose', 'grid.rotate'],
|
|
11377
11381
|
},
|
|
11378
11382
|
'flip-v': {
|
|
11379
11383
|
category: 'grid',
|
|
@@ -11399,7 +11403,7 @@ const moduleDocs$5 = {
|
|
|
11399
11403
|
'let { flip-v } = import(grid);\nflip-v([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n])',
|
|
11400
11404
|
'let { flip-v } = import(grid);\nflip-v([\n [1, 2],\n [3, 4],\n])',
|
|
11401
11405
|
],
|
|
11402
|
-
seeAlso: ['grid.flip-h', 'grid.transpose', 'grid.rotate'
|
|
11406
|
+
seeAlso: ['grid.flip-h', 'grid.transpose', 'grid.rotate'],
|
|
11403
11407
|
},
|
|
11404
11408
|
'rotate': {
|
|
11405
11409
|
category: 'grid',
|
|
@@ -11434,61 +11438,9 @@ const moduleDocs$5 = {
|
|
|
11434
11438
|
],
|
|
11435
11439
|
seeAlso: ['grid.transpose', 'grid.flip-h', 'grid.flip-v'],
|
|
11436
11440
|
},
|
|
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': {
|
|
11441
|
+
'crop': {
|
|
11464
11442
|
category: 'grid',
|
|
11465
|
-
description: '
|
|
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': {
|
|
11490
|
-
category: 'grid',
|
|
11491
|
-
description: 'Slices the grid `g` from the starting index `begin` to the optional ending index `stop`. The slice is inclusive of the starting index and exclusive of the ending index.',
|
|
11443
|
+
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
11444
|
returns: {
|
|
11493
11445
|
type: 'grid',
|
|
11494
11446
|
},
|
|
@@ -11522,8 +11474,8 @@ const moduleDocs$5 = {
|
|
|
11522
11474
|
},
|
|
11523
11475
|
],
|
|
11524
11476
|
examples: [
|
|
11525
|
-
'
|
|
11526
|
-
'
|
|
11477
|
+
'let { crop } = import(grid);\ncrop([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], [1, 1], [2, 2])',
|
|
11478
|
+
'let { crop } = import(grid);\ncrop([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], [1, 1])',
|
|
11527
11479
|
],
|
|
11528
11480
|
hideOperatorForm: true,
|
|
11529
11481
|
seeAlso: ['grid.slice-rows', 'grid.slice-cols'],
|
|
@@ -11568,7 +11520,7 @@ const moduleDocs$5 = {
|
|
|
11568
11520
|
'let { slice-rows } = import(grid);\nslice-rows([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1)',
|
|
11569
11521
|
],
|
|
11570
11522
|
hideOperatorForm: true,
|
|
11571
|
-
seeAlso: ['grid.
|
|
11523
|
+
seeAlso: ['grid.crop', 'grid.slice-cols', 'grid.splice-rows'],
|
|
11572
11524
|
},
|
|
11573
11525
|
'slice-cols': {
|
|
11574
11526
|
category: 'grid',
|
|
@@ -11610,7 +11562,7 @@ const moduleDocs$5 = {
|
|
|
11610
11562
|
'let { slice-cols } = import(grid);\nslice-cols([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1)',
|
|
11611
11563
|
],
|
|
11612
11564
|
hideOperatorForm: true,
|
|
11613
|
-
seeAlso: ['grid.
|
|
11565
|
+
seeAlso: ['grid.crop', 'grid.slice-rows', 'grid.splice-cols'],
|
|
11614
11566
|
},
|
|
11615
11567
|
'splice-rows': {
|
|
11616
11568
|
category: 'grid',
|
|
@@ -11764,7 +11716,7 @@ const moduleDocs$5 = {
|
|
|
11764
11716
|
],
|
|
11765
11717
|
seeAlso: ['grid.concat-rows', 'grid.push-cols'],
|
|
11766
11718
|
},
|
|
11767
|
-
'map': {
|
|
11719
|
+
'cell-map': {
|
|
11768
11720
|
category: 'grid',
|
|
11769
11721
|
description: 'Maps a function `a` over each element of the grid `b`, returning a new grid with the results.',
|
|
11770
11722
|
returns: {
|
|
@@ -11787,11 +11739,11 @@ const moduleDocs$5 = {
|
|
|
11787
11739
|
},
|
|
11788
11740
|
],
|
|
11789
11741
|
examples: [
|
|
11790
|
-
'
|
|
11742
|
+
'let { cell-map } = import(grid);\ncell-map([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], str)',
|
|
11791
11743
|
],
|
|
11792
|
-
seeAlso: ['map', 'grid.mapi', 'grid.reduce'],
|
|
11744
|
+
seeAlso: ['map', 'grid.cell-mapi', 'grid.cell-reduce'],
|
|
11793
11745
|
},
|
|
11794
|
-
'mapi': {
|
|
11746
|
+
'cell-mapi': {
|
|
11795
11747
|
category: 'grid',
|
|
11796
11748
|
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
11749
|
returns: {
|
|
@@ -11814,11 +11766,11 @@ const moduleDocs$5 = {
|
|
|
11814
11766
|
},
|
|
11815
11767
|
],
|
|
11816
11768
|
examples: [
|
|
11817
|
-
'
|
|
11769
|
+
'let { cell-mapi } = import(grid);\ncell-mapi([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], -> $1 ++ "(" ++ $2 ++ ", " ++ $3 ++ ")")',
|
|
11818
11770
|
],
|
|
11819
|
-
seeAlso: ['grid.map', 'grid.reducei', 'map'],
|
|
11771
|
+
seeAlso: ['grid.cell-map', 'grid.cell-reducei', 'map'],
|
|
11820
11772
|
},
|
|
11821
|
-
'reduce': {
|
|
11773
|
+
'cell-reduce': {
|
|
11822
11774
|
category: 'grid',
|
|
11823
11775
|
description: 'Reduces the grid `a` using the function `b`, returning a single value.',
|
|
11824
11776
|
returns: {
|
|
@@ -11848,11 +11800,11 @@ const moduleDocs$5 = {
|
|
|
11848
11800
|
},
|
|
11849
11801
|
],
|
|
11850
11802
|
examples: [
|
|
11851
|
-
'// Using "as" alias because "reduce" shadows a builtin function\nlet {
|
|
11803
|
+
'// 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
11804
|
],
|
|
11853
|
-
seeAlso: ['reduce', 'grid.reducei', 'grid.map'],
|
|
11805
|
+
seeAlso: ['reduce', 'grid.cell-reducei', 'grid.cell-map'],
|
|
11854
11806
|
},
|
|
11855
|
-
'reducei': {
|
|
11807
|
+
'cell-reducei': {
|
|
11856
11808
|
category: 'grid',
|
|
11857
11809
|
description: 'Reduces the grid `a` using the function `b`, passing the row and column indices as additional arguments to the function.',
|
|
11858
11810
|
returns: {
|
|
@@ -11882,9 +11834,9 @@ const moduleDocs$5 = {
|
|
|
11882
11834
|
},
|
|
11883
11835
|
],
|
|
11884
11836
|
examples: [
|
|
11885
|
-
'// Using "as" alias because "reducei" shadows a builtin function\nlet {
|
|
11837
|
+
'// 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
11838
|
],
|
|
11887
|
-
seeAlso: ['grid.reduce', 'grid.mapi', 'reduce'],
|
|
11839
|
+
seeAlso: ['grid.cell-reduce', 'grid.cell-mapi', 'reduce'],
|
|
11888
11840
|
},
|
|
11889
11841
|
'push-rows': {
|
|
11890
11842
|
category: 'grid',
|
|
@@ -12169,7 +12121,7 @@ function transpose(grid) {
|
|
|
12169
12121
|
}
|
|
12170
12122
|
|
|
12171
12123
|
const gridFunctions = {
|
|
12172
|
-
'every?': {
|
|
12124
|
+
'cell-every?': {
|
|
12173
12125
|
evaluate: ([grid, predicate], sourceCodeInfo, contextStack, { executeFunction }) => {
|
|
12174
12126
|
assertGrid(grid, sourceCodeInfo);
|
|
12175
12127
|
assertFunctionLike(predicate, sourceCodeInfo);
|
|
@@ -12372,21 +12324,7 @@ const gridFunctions = {
|
|
|
12372
12324
|
},
|
|
12373
12325
|
arity: toFixedArity(2),
|
|
12374
12326
|
},
|
|
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': {
|
|
12327
|
+
'crop': {
|
|
12390
12328
|
evaluate: ([grid, start, end], sourceCodeInfo) => {
|
|
12391
12329
|
assertGrid(grid, sourceCodeInfo);
|
|
12392
12330
|
assertVector(start, sourceCodeInfo);
|
|
@@ -12554,7 +12492,7 @@ const gridFunctions = {
|
|
|
12554
12492
|
},
|
|
12555
12493
|
arity: { min: 1 },
|
|
12556
12494
|
},
|
|
12557
|
-
'map': {
|
|
12495
|
+
'cell-map': {
|
|
12558
12496
|
evaluate: (params, sourceCodeInfo, contextStack, { executeFunction }) => {
|
|
12559
12497
|
const fn = asFunctionLike(params.at(-1), sourceCodeInfo);
|
|
12560
12498
|
const grids = params.slice(0, -1);
|
|
@@ -12579,7 +12517,7 @@ const gridFunctions = {
|
|
|
12579
12517
|
},
|
|
12580
12518
|
arity: { min: 2 },
|
|
12581
12519
|
},
|
|
12582
|
-
'mapi': {
|
|
12520
|
+
'cell-mapi': {
|
|
12583
12521
|
evaluate: ([grid, fn], sourceCodeInfo, contextStack, { executeFunction }) => {
|
|
12584
12522
|
assertGrid(grid, sourceCodeInfo);
|
|
12585
12523
|
assertFunctionLike(fn, sourceCodeInfo);
|
|
@@ -12593,7 +12531,7 @@ const gridFunctions = {
|
|
|
12593
12531
|
},
|
|
12594
12532
|
arity: toFixedArity(2),
|
|
12595
12533
|
},
|
|
12596
|
-
'reduce': {
|
|
12534
|
+
'cell-reduce': {
|
|
12597
12535
|
evaluate: ([grid, fn, initialValue], sourceCodeInfo, contextStack, { executeFunction }) => {
|
|
12598
12536
|
assertGrid(grid, sourceCodeInfo);
|
|
12599
12537
|
assertFunctionLike(fn, sourceCodeInfo);
|
|
@@ -12607,7 +12545,7 @@ const gridFunctions = {
|
|
|
12607
12545
|
},
|
|
12608
12546
|
arity: toFixedArity(3),
|
|
12609
12547
|
},
|
|
12610
|
-
'reducei': {
|
|
12548
|
+
'cell-reducei': {
|
|
12611
12549
|
evaluate: ([grid, fn, initialValue], sourceCodeInfo, contextStack, { executeFunction }) => {
|
|
12612
12550
|
assertGrid(grid, sourceCodeInfo);
|
|
12613
12551
|
assertFunctionLike(fn, sourceCodeInfo);
|
|
@@ -12761,7 +12699,8 @@ const moduleDocs$4 = {
|
|
|
12761
12699
|
},
|
|
12762
12700
|
],
|
|
12763
12701
|
examples: [
|
|
12764
|
-
|
|
12702
|
+
`let { random! } = import(random);
|
|
12703
|
+
random!()`,
|
|
12765
12704
|
],
|
|
12766
12705
|
seeAlso: ['random.random-float!', 'random.random-int!', 'random.random-boolean!'],
|
|
12767
12706
|
},
|
|
@@ -12790,8 +12729,10 @@ const moduleDocs$4 = {
|
|
|
12790
12729
|
},
|
|
12791
12730
|
],
|
|
12792
12731
|
examples: [
|
|
12793
|
-
|
|
12794
|
-
|
|
12732
|
+
`let { random-int! } = import(random);
|
|
12733
|
+
random-int!(0, 10)`,
|
|
12734
|
+
`let { random-int! } = import(random);
|
|
12735
|
+
random-int!(1, 100)`,
|
|
12795
12736
|
],
|
|
12796
12737
|
seeAlso: ['random.random-int-inclusive!', 'random.random-float!', 'random.random!'],
|
|
12797
12738
|
},
|
|
@@ -12820,7 +12761,8 @@ const moduleDocs$4 = {
|
|
|
12820
12761
|
},
|
|
12821
12762
|
],
|
|
12822
12763
|
examples: [
|
|
12823
|
-
|
|
12764
|
+
`let { random-int-inclusive! } = import(random);
|
|
12765
|
+
random-int-inclusive!(0, 10)`,
|
|
12824
12766
|
],
|
|
12825
12767
|
seeAlso: ['random.random-int!', 'random.random-float!'],
|
|
12826
12768
|
},
|
|
@@ -12849,8 +12791,10 @@ const moduleDocs$4 = {
|
|
|
12849
12791
|
},
|
|
12850
12792
|
],
|
|
12851
12793
|
examples: [
|
|
12852
|
-
|
|
12853
|
-
|
|
12794
|
+
`let { random-float! } = import(random);
|
|
12795
|
+
random-float!(0, 10)`,
|
|
12796
|
+
`let { random-float! } = import(random);
|
|
12797
|
+
random-float!(1, 100)`,
|
|
12854
12798
|
],
|
|
12855
12799
|
seeAlso: ['random.random!', 'random.random-int!', 'random.random-int-inclusive!'],
|
|
12856
12800
|
},
|
|
@@ -12874,8 +12818,10 @@ const moduleDocs$4 = {
|
|
|
12874
12818
|
},
|
|
12875
12819
|
],
|
|
12876
12820
|
examples: [
|
|
12877
|
-
|
|
12878
|
-
|
|
12821
|
+
`let { random-boolean! } = import(random);
|
|
12822
|
+
random-boolean!()`,
|
|
12823
|
+
`let { random-boolean! } = import(random);
|
|
12824
|
+
random-boolean!(0.99)`,
|
|
12879
12825
|
],
|
|
12880
12826
|
seeAlso: ['random.random!'],
|
|
12881
12827
|
},
|
|
@@ -12899,8 +12845,10 @@ const moduleDocs$4 = {
|
|
|
12899
12845
|
},
|
|
12900
12846
|
],
|
|
12901
12847
|
examples: [
|
|
12902
|
-
|
|
12903
|
-
|
|
12848
|
+
`let { random-item! } = import(random);
|
|
12849
|
+
random-item!([1, 2, 3, 4, 5])`,
|
|
12850
|
+
`let { random-item! } = import(random);
|
|
12851
|
+
random-item!(["apple", "banana", "cherry"])`,
|
|
12904
12852
|
],
|
|
12905
12853
|
seeAlso: ['random.random-sample!', 'random.random-sample-unique!', 'random.random-char!'],
|
|
12906
12854
|
},
|
|
@@ -12929,8 +12877,10 @@ const moduleDocs$4 = {
|
|
|
12929
12877
|
},
|
|
12930
12878
|
],
|
|
12931
12879
|
examples: [
|
|
12932
|
-
|
|
12933
|
-
|
|
12880
|
+
`let { random-sample-unique! } = import(random);
|
|
12881
|
+
random-sample-unique!([1, 2, 3, 4, 5], 3)`,
|
|
12882
|
+
`let { random-sample-unique! } = import(random);
|
|
12883
|
+
random-sample-unique!(["apple", "banana", "cherry"], 2)`,
|
|
12934
12884
|
],
|
|
12935
12885
|
seeAlso: ['random.random-sample!', 'random.random-item!', 'random.shuffle!'],
|
|
12936
12886
|
},
|
|
@@ -12959,8 +12909,10 @@ const moduleDocs$4 = {
|
|
|
12959
12909
|
},
|
|
12960
12910
|
],
|
|
12961
12911
|
examples: [
|
|
12962
|
-
|
|
12963
|
-
|
|
12912
|
+
`let { random-sample! } = import(random);
|
|
12913
|
+
random-sample!([1, 2, 3, 4, 5], 3)`,
|
|
12914
|
+
`let { random-sample! } = import(random);
|
|
12915
|
+
random-sample!(["apple", "banana", "cherry"], 10)`,
|
|
12964
12916
|
],
|
|
12965
12917
|
seeAlso: ['random.random-sample-unique!', 'random.random-item!', 'random.shuffle!'],
|
|
12966
12918
|
},
|
|
@@ -12984,8 +12936,10 @@ const moduleDocs$4 = {
|
|
|
12984
12936
|
},
|
|
12985
12937
|
],
|
|
12986
12938
|
examples: [
|
|
12987
|
-
|
|
12988
|
-
|
|
12939
|
+
`let { shuffle! } = import(random);
|
|
12940
|
+
shuffle!([1, 2, 3, 4, 5])`,
|
|
12941
|
+
`let { shuffle! } = import(random);
|
|
12942
|
+
shuffle!(["apple", "banana", "cherry"])`,
|
|
12989
12943
|
],
|
|
12990
12944
|
seeAlso: ['random.random-sample!', 'random.random-sample-unique!'],
|
|
12991
12945
|
},
|
|
@@ -13014,8 +12968,10 @@ const moduleDocs$4 = {
|
|
|
13014
12968
|
},
|
|
13015
12969
|
],
|
|
13016
12970
|
examples: [
|
|
13017
|
-
|
|
13018
|
-
|
|
12971
|
+
`let { random-normal! } = import(random);
|
|
12972
|
+
random-normal!(0, 1)`,
|
|
12973
|
+
`let { random-normal! } = import(random);
|
|
12974
|
+
random-normal!(5, 2)`,
|
|
13019
12975
|
],
|
|
13020
12976
|
seeAlso: ['random.random-exponential!', 'random.random-binomial!', 'random.random-poisson!'],
|
|
13021
12977
|
hideOperatorForm: true,
|
|
@@ -13040,8 +12996,10 @@ const moduleDocs$4 = {
|
|
|
13040
12996
|
},
|
|
13041
12997
|
],
|
|
13042
12998
|
examples: [
|
|
13043
|
-
|
|
13044
|
-
|
|
12999
|
+
`let { random-exponential! } = import(random);
|
|
13000
|
+
random-exponential!(1)`,
|
|
13001
|
+
`let { random-exponential! } = import(random);
|
|
13002
|
+
random-exponential!(0.5)`,
|
|
13045
13003
|
],
|
|
13046
13004
|
seeAlso: ['random.random-normal!', 'random.random-poisson!', 'random.random-gamma!', 'random.random-pareto!'],
|
|
13047
13005
|
},
|
|
@@ -13070,8 +13028,10 @@ const moduleDocs$4 = {
|
|
|
13070
13028
|
},
|
|
13071
13029
|
],
|
|
13072
13030
|
examples: [
|
|
13073
|
-
|
|
13074
|
-
|
|
13031
|
+
`let { random-binomial! } = import(random);
|
|
13032
|
+
random-binomial!(10, 0.5)`,
|
|
13033
|
+
`let { random-binomial! } = import(random);
|
|
13034
|
+
random-binomial!(20, 0.3)`,
|
|
13075
13035
|
],
|
|
13076
13036
|
seeAlso: ['random.random-normal!', 'random.random-poisson!'],
|
|
13077
13037
|
hideOperatorForm: true,
|
|
@@ -13096,8 +13056,10 @@ const moduleDocs$4 = {
|
|
|
13096
13056
|
},
|
|
13097
13057
|
],
|
|
13098
13058
|
examples: [
|
|
13099
|
-
|
|
13100
|
-
|
|
13059
|
+
`let { random-poisson! } = import(random);
|
|
13060
|
+
random-poisson!(1)`,
|
|
13061
|
+
`let { random-poisson! } = import(random);
|
|
13062
|
+
random-poisson!(5)`,
|
|
13101
13063
|
],
|
|
13102
13064
|
seeAlso: ['random.random-binomial!', 'random.random-normal!', 'random.random-exponential!'],
|
|
13103
13065
|
},
|
|
@@ -13126,8 +13088,10 @@ const moduleDocs$4 = {
|
|
|
13126
13088
|
},
|
|
13127
13089
|
],
|
|
13128
13090
|
examples: [
|
|
13129
|
-
|
|
13130
|
-
|
|
13091
|
+
`let { random-gamma! } = import(random);
|
|
13092
|
+
random-gamma!(2, 2)`,
|
|
13093
|
+
`let { random-gamma! } = import(random);
|
|
13094
|
+
random-gamma!(5, 1)`,
|
|
13131
13095
|
],
|
|
13132
13096
|
seeAlso: ['random.random-exponential!', 'random.random-pareto!'],
|
|
13133
13097
|
hideOperatorForm: true,
|
|
@@ -13152,8 +13116,10 @@ const moduleDocs$4 = {
|
|
|
13152
13116
|
},
|
|
13153
13117
|
],
|
|
13154
13118
|
examples: [
|
|
13155
|
-
|
|
13156
|
-
|
|
13119
|
+
`let { random-pareto! } = import(random);
|
|
13120
|
+
random-pareto!(1)`,
|
|
13121
|
+
`let { random-pareto! } = import(random);
|
|
13122
|
+
random-pareto!(2)`,
|
|
13157
13123
|
],
|
|
13158
13124
|
seeAlso: ['random.random-gamma!', 'random.random-exponential!'],
|
|
13159
13125
|
},
|
|
@@ -13170,7 +13136,8 @@ const moduleDocs$4 = {
|
|
|
13170
13136
|
},
|
|
13171
13137
|
],
|
|
13172
13138
|
examples: [
|
|
13173
|
-
|
|
13139
|
+
`let { uuid! } = import(random);
|
|
13140
|
+
uuid!()`,
|
|
13174
13141
|
],
|
|
13175
13142
|
seeAlso: ['random.random-id!', 'random.random-string!'],
|
|
13176
13143
|
},
|
|
@@ -13194,8 +13161,10 @@ const moduleDocs$4 = {
|
|
|
13194
13161
|
},
|
|
13195
13162
|
],
|
|
13196
13163
|
examples: [
|
|
13197
|
-
|
|
13198
|
-
|
|
13164
|
+
`let { random-char! } = import(random);
|
|
13165
|
+
random-char!("abcde")`,
|
|
13166
|
+
`let { random-char! } = import(random);
|
|
13167
|
+
random-char!("ABCDEFGHIJKLMNOPQRSTUVWXYZ")`,
|
|
13199
13168
|
],
|
|
13200
13169
|
seeAlso: ['random.random-string!', 'random.random-item!'],
|
|
13201
13170
|
},
|
|
@@ -13224,8 +13193,10 @@ const moduleDocs$4 = {
|
|
|
13224
13193
|
},
|
|
13225
13194
|
],
|
|
13226
13195
|
examples: [
|
|
13227
|
-
|
|
13228
|
-
|
|
13196
|
+
`let { random-string! } = import(random);
|
|
13197
|
+
random-string!(10, "abcde")`,
|
|
13198
|
+
`let { random-string! } = import(random);
|
|
13199
|
+
random-string!(5, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")`,
|
|
13229
13200
|
],
|
|
13230
13201
|
seeAlso: ['random.random-char!', 'random.random-id!', 'random.uuid!'],
|
|
13231
13202
|
hideOperatorForm: true,
|
|
@@ -13250,8 +13221,10 @@ const moduleDocs$4 = {
|
|
|
13250
13221
|
},
|
|
13251
13222
|
],
|
|
13252
13223
|
examples: [
|
|
13253
|
-
|
|
13254
|
-
|
|
13224
|
+
`let { random-id! } = import(random);
|
|
13225
|
+
random-id!(10)`,
|
|
13226
|
+
`let { random-id! } = import(random);
|
|
13227
|
+
random-id!(5)`,
|
|
13255
13228
|
],
|
|
13256
13229
|
seeAlso: ['random.random-string!', 'random.uuid!'],
|
|
13257
13230
|
},
|
|
@@ -13268,7 +13241,8 @@ const moduleDocs$4 = {
|
|
|
13268
13241
|
},
|
|
13269
13242
|
],
|
|
13270
13243
|
examples: [
|
|
13271
|
-
|
|
13244
|
+
`let { random-color! } = import(random);
|
|
13245
|
+
random-color!()`,
|
|
13272
13246
|
],
|
|
13273
13247
|
},
|
|
13274
13248
|
};
|
|
@@ -13566,31 +13540,6 @@ const randomModule = {
|
|
|
13566
13540
|
};
|
|
13567
13541
|
|
|
13568
13542
|
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
13543
|
'moving-mean': {
|
|
13595
13544
|
category: 'vector',
|
|
13596
13545
|
description: 'Returns the **moving mean** of the `vector` with a given window size.',
|
|
@@ -13625,7 +13574,7 @@ const moduleDocs$3 = {
|
|
|
13625
13574
|
'let { moving-mean } = import(vector);\nmoving-mean([1, 2, 3, 4, 5], 3)',
|
|
13626
13575
|
'let { moving-mean } = import(vector);\nmoving-mean([1, 2, 3, 4, 5], 5)',
|
|
13627
13576
|
],
|
|
13628
|
-
seeAlso: ['moving-fn', '
|
|
13577
|
+
seeAlso: ['moving-fn', 'mean', 'vector.centered-moving-mean', 'vector.running-mean'],
|
|
13629
13578
|
},
|
|
13630
13579
|
'centered-moving-mean': {
|
|
13631
13580
|
category: 'vector',
|
|
@@ -13685,7 +13634,7 @@ const moduleDocs$3 = {
|
|
|
13685
13634
|
'let { centered-moving-mean } = import(vector);\ncentered-moving-mean([1, 2, 3, 4, 5], 3, 0, 10)',
|
|
13686
13635
|
'let { centered-moving-mean } = import(vector);\ncentered-moving-mean([1, 2, 3, 4, 5], 3, 10)',
|
|
13687
13636
|
],
|
|
13688
|
-
seeAlso: ['
|
|
13637
|
+
seeAlso: ['mean', 'vector.moving-mean', 'vector.running-mean'],
|
|
13689
13638
|
},
|
|
13690
13639
|
'running-mean': {
|
|
13691
13640
|
category: 'vector',
|
|
@@ -13709,7 +13658,7 @@ const moduleDocs$3 = {
|
|
|
13709
13658
|
examples: [
|
|
13710
13659
|
'let { running-mean } = import(vector);\nrunning-mean([1, 2, 3, 4, 5])',
|
|
13711
13660
|
],
|
|
13712
|
-
seeAlso: ['running-fn', '
|
|
13661
|
+
seeAlso: ['running-fn', 'mean', 'vector.moving-mean', 'vector.centered-moving-mean'],
|
|
13713
13662
|
},
|
|
13714
13663
|
'geometric-mean': {
|
|
13715
13664
|
category: 'vector',
|
|
@@ -13734,7 +13683,7 @@ const moduleDocs$3 = {
|
|
|
13734
13683
|
'let { geometric-mean } = import(vector);\ngeometric-mean([1, 2, 3])',
|
|
13735
13684
|
'let { geometric-mean } = import(vector);\ngeometric-mean([1, 2, 9])',
|
|
13736
13685
|
],
|
|
13737
|
-
seeAlso: ['vector.moving-geometric-mean', 'vector.centered-moving-geometric-mean', 'vector.running-geometric-mean', '
|
|
13686
|
+
seeAlso: ['vector.moving-geometric-mean', 'vector.centered-moving-geometric-mean', 'vector.running-geometric-mean', 'mean', 'vector.harmonic-mean'],
|
|
13738
13687
|
},
|
|
13739
13688
|
'moving-geometric-mean': {
|
|
13740
13689
|
category: 'vector',
|
|
@@ -13879,7 +13828,7 @@ const moduleDocs$3 = {
|
|
|
13879
13828
|
'let { harmonic-mean } = import(vector);\nharmonic-mean([1, 2, 3])',
|
|
13880
13829
|
'let { harmonic-mean } = import(vector);\nharmonic-mean([1, 2, 9])',
|
|
13881
13830
|
],
|
|
13882
|
-
seeAlso: ['vector.moving-harmonic-mean', 'vector.centered-moving-harmonic-mean', 'vector.running-harmonic-mean', '
|
|
13831
|
+
seeAlso: ['vector.moving-harmonic-mean', 'vector.centered-moving-harmonic-mean', 'vector.running-harmonic-mean', 'mean', 'vector.geometric-mean'],
|
|
13883
13832
|
},
|
|
13884
13833
|
'moving-harmonic-mean': {
|
|
13885
13834
|
category: 'vector',
|
|
@@ -14001,33 +13950,6 @@ const moduleDocs$3 = {
|
|
|
14001
13950
|
],
|
|
14002
13951
|
seeAlso: ['vector.harmonic-mean', 'vector.moving-harmonic-mean', 'vector.centered-moving-harmonic-mean'],
|
|
14003
13952
|
},
|
|
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
13953
|
'moving-median': {
|
|
14032
13954
|
category: 'vector',
|
|
14033
13955
|
description: 'Returns the **moving median** of the `vector` with a given window size.',
|
|
@@ -14062,7 +13984,7 @@ const moduleDocs$3 = {
|
|
|
14062
13984
|
'let { moving-median } = import(vector);\nmoving-median([1, 2, 3, 4, 5], 3)',
|
|
14063
13985
|
'let { moving-median } = import(vector);\nmoving-median([1, 2, 3, 4, 5], 5)',
|
|
14064
13986
|
],
|
|
14065
|
-
seeAlso: ['
|
|
13987
|
+
seeAlso: ['median', 'vector.centered-moving-median', 'vector.running-median'],
|
|
14066
13988
|
},
|
|
14067
13989
|
'centered-moving-median': {
|
|
14068
13990
|
category: 'vector',
|
|
@@ -14122,7 +14044,7 @@ const moduleDocs$3 = {
|
|
|
14122
14044
|
'let { centered-moving-median } = import(vector);\ncentered-moving-median([1, 2, 3, 4, 5], 3, 0, 10)',
|
|
14123
14045
|
'let { centered-moving-median } = import(vector);\ncentered-moving-median([1, 2, 3, 4, 5], 3, 10)',
|
|
14124
14046
|
],
|
|
14125
|
-
seeAlso: ['
|
|
14047
|
+
seeAlso: ['median', 'vector.moving-median', 'vector.running-median'],
|
|
14126
14048
|
},
|
|
14127
14049
|
'running-median': {
|
|
14128
14050
|
category: 'vector',
|
|
@@ -14146,7 +14068,7 @@ const moduleDocs$3 = {
|
|
|
14146
14068
|
examples: [
|
|
14147
14069
|
'let { running-median } = import(vector);\nrunning-median([1, 2, 3, 4, 5])',
|
|
14148
14070
|
],
|
|
14149
|
-
seeAlso: ['
|
|
14071
|
+
seeAlso: ['median', 'vector.moving-median', 'vector.centered-moving-median'],
|
|
14150
14072
|
},
|
|
14151
14073
|
'variance': {
|
|
14152
14074
|
category: 'vector',
|
|
@@ -14764,10 +14686,10 @@ const moduleDocs$3 = {
|
|
|
14764
14686
|
'let { iqr } = import(vector);\niqr([1, 2, 3, 4])',
|
|
14765
14687
|
'let { iqr } = import(vector);\niqr([5, 4, 3, 2, 1, 2, 3, 4, 5])',
|
|
14766
14688
|
'let { iqr } = import(vector);\niqr(range(1, 1000))',
|
|
14767
|
-
'let { iqr
|
|
14768
|
-
'let { iqr
|
|
14689
|
+
'let { iqr } = import(vector);\niqr(map(range(1000), -> 1e6 / ($ + 1) ^ 2))',
|
|
14690
|
+
'let { iqr } = import(vector);\nlet { ln } = import(math);\niqr(map(range(1000), -> ln($ + 1)))',
|
|
14769
14691
|
],
|
|
14770
|
-
seeAlso: ['vector.moving-iqr', 'vector.centered-moving-iqr', 'vector.running-iqr', 'vector.quartiles', '
|
|
14692
|
+
seeAlso: ['vector.moving-iqr', 'vector.centered-moving-iqr', 'vector.running-iqr', 'vector.quartiles', 'median', 'vector.mad', 'vector.medad', 'vector.outliers?', 'vector.outliers'],
|
|
14771
14693
|
},
|
|
14772
14694
|
'moving-iqr': {
|
|
14773
14695
|
category: 'vector',
|
|
@@ -14890,31 +14812,6 @@ const moduleDocs$3 = {
|
|
|
14890
14812
|
],
|
|
14891
14813
|
seeAlso: ['vector.iqr', 'vector.moving-iqr', 'vector.centered-moving-iqr'],
|
|
14892
14814
|
},
|
|
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
14815
|
'moving-sum': {
|
|
14919
14816
|
category: 'vector',
|
|
14920
14817
|
description: 'Returns the **moving sum** of the `vector` with a given window size.',
|
|
@@ -14949,7 +14846,7 @@ const moduleDocs$3 = {
|
|
|
14949
14846
|
'let { moving-sum } = import(vector);\nmoving-sum([1, 2, 3, 4, 5], 3)',
|
|
14950
14847
|
'let { moving-sum } = import(vector);\nmoving-sum([1, 2, 3, 4, 5], 5)',
|
|
14951
14848
|
],
|
|
14952
|
-
seeAlso: ['
|
|
14849
|
+
seeAlso: ['sum', 'vector.centered-moving-sum', 'vector.running-sum'],
|
|
14953
14850
|
},
|
|
14954
14851
|
'centered-moving-sum': {
|
|
14955
14852
|
category: 'vector',
|
|
@@ -15009,7 +14906,7 @@ const moduleDocs$3 = {
|
|
|
15009
14906
|
'let { centered-moving-sum } = import(vector);\ncentered-moving-sum([1, 2, 3, 4, 5], 3, 0, 0)',
|
|
15010
14907
|
'let { centered-moving-sum } = import(vector);\ncentered-moving-sum([1, 2, 3, 4, 5], 3, 10)',
|
|
15011
14908
|
],
|
|
15012
|
-
seeAlso: ['
|
|
14909
|
+
seeAlso: ['sum', 'vector.moving-sum', 'vector.running-sum'],
|
|
15013
14910
|
},
|
|
15014
14911
|
'running-sum': {
|
|
15015
14912
|
category: 'vector',
|
|
@@ -15034,32 +14931,7 @@ const moduleDocs$3 = {
|
|
|
15034
14931
|
'let { running-sum } = import(vector);\nrunning-sum([1, 2, 3])',
|
|
15035
14932
|
'let { running-sum } = import(vector);\nrunning-sum([1, -2, -3])',
|
|
15036
14933
|
],
|
|
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'],
|
|
14934
|
+
seeAlso: ['sum', 'vector.moving-sum', 'vector.centered-moving-sum', 'vector.cumsum'],
|
|
15063
14935
|
},
|
|
15064
14936
|
'moving-prod': {
|
|
15065
14937
|
category: 'vector',
|
|
@@ -15095,7 +14967,7 @@ const moduleDocs$3 = {
|
|
|
15095
14967
|
'let { moving-prod } = import(vector);\nmoving-prod([1, 2, 3, 4, 5], 3)',
|
|
15096
14968
|
'let { moving-prod } = import(vector);\nmoving-prod([1, 2, 3, 4, 5], 5)',
|
|
15097
14969
|
],
|
|
15098
|
-
seeAlso: ['
|
|
14970
|
+
seeAlso: ['prod', 'vector.centered-moving-prod', 'vector.running-prod'],
|
|
15099
14971
|
},
|
|
15100
14972
|
'centered-moving-prod': {
|
|
15101
14973
|
category: 'vector',
|
|
@@ -15154,7 +15026,7 @@ const moduleDocs$3 = {
|
|
|
15154
15026
|
'let { centered-moving-prod } = import(vector);\ncentered-moving-prod([1, 2, 3, 4, 5], 3)',
|
|
15155
15027
|
'let { centered-moving-prod } = import(vector);\ncentered-moving-prod([1, 2, 3, 4, 5], 3, 0, 0)',
|
|
15156
15028
|
],
|
|
15157
|
-
seeAlso: ['
|
|
15029
|
+
seeAlso: ['prod', 'vector.moving-prod', 'vector.running-prod'],
|
|
15158
15030
|
},
|
|
15159
15031
|
'running-prod': {
|
|
15160
15032
|
category: 'vector',
|
|
@@ -15179,7 +15051,7 @@ const moduleDocs$3 = {
|
|
|
15179
15051
|
'let { running-prod } = import(vector);\nrunning-prod([1, 2, 3, 4, 5])',
|
|
15180
15052
|
'let { running-prod } = import(vector);\nrunning-prod([1, -2, -3])',
|
|
15181
15053
|
],
|
|
15182
|
-
seeAlso: ['
|
|
15054
|
+
seeAlso: ['prod', 'vector.moving-prod', 'vector.centered-moving-prod', 'vector.cumprod'],
|
|
15183
15055
|
},
|
|
15184
15056
|
'span': {
|
|
15185
15057
|
category: 'vector',
|
|
@@ -16214,10 +16086,10 @@ const moduleDocs$3 = {
|
|
|
16214
16086
|
'let { rms } = import(vector);\nrms([1, 2, 3, 4])',
|
|
16215
16087
|
'let { rms } = import(vector);\nrms([5, 4, 3, 2, 1])',
|
|
16216
16088
|
'let { rms } = import(vector);\nrms(range(1, 1000))',
|
|
16217
|
-
'let { rms
|
|
16218
|
-
'let { rms
|
|
16089
|
+
'let { rms } = import(vector);\nrms(map(range(1000), -> 1e6 / ($ + 1) ^ 2))',
|
|
16090
|
+
'let { rms } = import(vector);\nlet { ln } = import(math);\nrms(map(range(1000), -> ln($ + 1)))',
|
|
16219
16091
|
],
|
|
16220
|
-
seeAlso: ['vector.moving-rms', 'vector.centered-moving-rms', 'vector.running-rms', '
|
|
16092
|
+
seeAlso: ['vector.moving-rms', 'vector.centered-moving-rms', 'vector.running-rms', 'mean', 'vector.stdev'],
|
|
16221
16093
|
},
|
|
16222
16094
|
'moving-rms': {
|
|
16223
16095
|
category: 'vector',
|
|
@@ -16511,7 +16383,7 @@ const moduleDocs$3 = {
|
|
|
16511
16383
|
'let { medad } = import(vector);\nmedad([1, 2, 3])',
|
|
16512
16384
|
'let { medad } = import(vector);\nmedad([1, 2, -3])',
|
|
16513
16385
|
],
|
|
16514
|
-
seeAlso: ['vector.moving-medad', 'vector.centered-moving-medad', 'vector.running-medad', 'vector.mad', '
|
|
16386
|
+
seeAlso: ['vector.moving-medad', 'vector.centered-moving-medad', 'vector.running-medad', 'vector.mad', 'median', 'vector.iqr'],
|
|
16515
16387
|
},
|
|
16516
16388
|
'moving-medad': {
|
|
16517
16389
|
category: 'vector',
|
|
@@ -17135,7 +17007,7 @@ const moduleDocs$3 = {
|
|
|
17135
17007
|
'let { mode } = import(vector);\nmode([2, 2, 3, 3])',
|
|
17136
17008
|
'let { mode } = import(vector);\nmode([1, 2, 3, 2, 1, 2])',
|
|
17137
17009
|
],
|
|
17138
|
-
seeAlso: ['
|
|
17010
|
+
seeAlso: ['mean', 'median'],
|
|
17139
17011
|
},
|
|
17140
17012
|
'min-index': {
|
|
17141
17013
|
category: 'vector',
|
|
@@ -17285,165 +17157,6 @@ const moduleDocs$3 = {
|
|
|
17285
17157
|
],
|
|
17286
17158
|
seeAlso: [
|
|
17287
17159
|
'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
17160
|
],
|
|
17448
17161
|
},
|
|
17449
17162
|
'cumsum': {
|
|
@@ -17471,7 +17184,7 @@ const moduleDocs$3 = {
|
|
|
17471
17184
|
'let { cumsum } = import(vector);\ncumsum([1, 2, -3])',
|
|
17472
17185
|
'let { cumsum } = import(vector);\ncumsum([])',
|
|
17473
17186
|
],
|
|
17474
|
-
seeAlso: ['vector.cumprod', '
|
|
17187
|
+
seeAlso: ['vector.cumprod', 'sum', 'vector.running-sum'],
|
|
17475
17188
|
},
|
|
17476
17189
|
'cumprod': {
|
|
17477
17190
|
category: 'vector',
|
|
@@ -17498,7 +17211,7 @@ const moduleDocs$3 = {
|
|
|
17498
17211
|
'let { cumprod } = import(vector);\ncumprod([1, 2, -3, 0, 10])',
|
|
17499
17212
|
'let { cumprod } = import(vector);\ncumprod([])',
|
|
17500
17213
|
],
|
|
17501
|
-
seeAlso: ['vector.cumsum', '
|
|
17214
|
+
seeAlso: ['vector.cumsum', 'prod', 'vector.running-prod'],
|
|
17502
17215
|
},
|
|
17503
17216
|
'quartiles': {
|
|
17504
17217
|
category: 'vector',
|
|
@@ -17524,10 +17237,10 @@ const moduleDocs$3 = {
|
|
|
17524
17237
|
'let { quartiles } = import(vector);\nquartiles([1, 2, 3, 4])',
|
|
17525
17238
|
'let { quartiles } = import(vector);\nquartiles([5, 4, 3, 2, 1, 2, 3, 4, 5])',
|
|
17526
17239
|
'let { quartiles } = import(vector);\nquartiles(range(1, 1000))',
|
|
17527
|
-
'let { quartiles
|
|
17528
|
-
'let { quartiles
|
|
17240
|
+
'let { quartiles } = import(vector);\nquartiles(map(range(1000), -> 1e6 / ($ + 1) ^ 2))',
|
|
17241
|
+
'let { quartiles } = import(vector);\nlet { ln } = import(math);\nquartiles(map(range(1000), -> ln($ + 1)))',
|
|
17529
17242
|
],
|
|
17530
|
-
seeAlso: ['vector.percentile', 'vector.quantile', '
|
|
17243
|
+
seeAlso: ['vector.percentile', 'vector.quantile', 'median', 'vector.iqr'],
|
|
17531
17244
|
},
|
|
17532
17245
|
'percentile': {
|
|
17533
17246
|
category: 'vector',
|
|
@@ -17573,7 +17286,7 @@ const moduleDocs$3 = {
|
|
|
17573
17286
|
'let { percentile } = import(vector);\npercentile(range(100) ^ 0.5, 90)',
|
|
17574
17287
|
'let { percentile } = import(vector);\npercentile(range(100) ^ 0.5, 100)',
|
|
17575
17288
|
],
|
|
17576
|
-
seeAlso: ['vector.quantile', 'vector.quartiles', '
|
|
17289
|
+
seeAlso: ['vector.quantile', 'vector.quartiles', 'median', 'vector.ecdf', 'vector.winsorize'],
|
|
17577
17290
|
},
|
|
17578
17291
|
'quantile': {
|
|
17579
17292
|
category: 'vector',
|
|
@@ -18488,6 +18201,12 @@ addReductionFunctions$1(madReductionFunction);
|
|
|
18488
18201
|
addReductionFunctions$1(medadReductionFunction);
|
|
18489
18202
|
addReductionFunctions$1(giniCoefficientReductionFunction);
|
|
18490
18203
|
addReductionFunctions$1(entropyReductionFunction);
|
|
18204
|
+
// Remove base variants that duplicate core built-ins (sum, prod, mean, median).
|
|
18205
|
+
// The moving/centered-moving/running variants are unique to the vector module.
|
|
18206
|
+
delete reductionFunctionNormalExpressions.sum;
|
|
18207
|
+
delete reductionFunctionNormalExpressions.prod;
|
|
18208
|
+
delete reductionFunctionNormalExpressions.mean;
|
|
18209
|
+
delete reductionFunctionNormalExpressions.median;
|
|
18491
18210
|
function addReductionFunctions$1(fns) {
|
|
18492
18211
|
for (const [key, value] of Object.entries(fns)) {
|
|
18493
18212
|
/* v8 ignore next 3 */
|
|
@@ -18728,40 +18447,6 @@ const vectorFunctions = {
|
|
|
18728
18447
|
},
|
|
18729
18448
|
arity: toFixedArity(3),
|
|
18730
18449
|
},
|
|
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
18450
|
'cumsum': {
|
|
18766
18451
|
evaluate: ([vector], sourceCodeInfo) => {
|
|
18767
18452
|
assertVector(vector, sourceCodeInfo);
|
|
@@ -19486,7 +19171,7 @@ const moduleDocs$2 = {
|
|
|
19486
19171
|
'let { orthogonal? } = import(linear-algebra);\northogonal?([1, 0, 1], [0, 1, 0])',
|
|
19487
19172
|
'let { orthogonal? } = import(linear-algebra);\northogonal?([1, 2], [2, -1])',
|
|
19488
19173
|
],
|
|
19489
|
-
seeAlso: ['linear-algebra.collinear?', 'linear-algebra.parallel?', 'linear-algebra.dot', 'matrix.orthogonal?', 'linear-algebra.angle'],
|
|
19174
|
+
seeAlso: ['linear-algebra.collinear?', 'linear-algebra.parallel?', 'linear-algebra.dot', 'matrix.orthogonal-matrix?', 'linear-algebra.angle'],
|
|
19490
19175
|
},
|
|
19491
19176
|
'cosine-similarity': {
|
|
19492
19177
|
category: 'linear-algebra',
|
|
@@ -20066,8 +19751,10 @@ const moduleDocs$2 = {
|
|
|
20066
19751
|
],
|
|
20067
19752
|
examples: [
|
|
20068
19753
|
'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
|
-
|
|
19754
|
+
`let { solve } = import(linear-algebra);
|
|
19755
|
+
solve([[2, 0, 0], [3, 1, 0], [4, 5, 6]], [4, 5, 38])`,
|
|
19756
|
+
`let { solve } = import(linear-algebra);
|
|
19757
|
+
solve([[2, 3], [1, -1]], [8, 2])`,
|
|
20071
19758
|
],
|
|
20072
19759
|
seeAlso: ['linear-algebra.rref', 'matrix.inv'],
|
|
20073
19760
|
},
|
|
@@ -21107,7 +20794,7 @@ const moduleDocs$1 = {
|
|
|
21107
20794
|
'let { inv } = import(matrix);\ninv([[1, 2], [3, 4]])',
|
|
21108
20795
|
'let { inv } = import(matrix);\ninv([[1, 2, 3], [4, 5, 7], [7, 8, 10]])',
|
|
21109
20796
|
],
|
|
21110
|
-
seeAlso: ['matrix.det', 'matrix.adj', 'matrix.invertible?', 'linear-algebra.solve', 'matrix.mul', 'matrix.orthogonal?'],
|
|
20797
|
+
seeAlso: ['matrix.det', 'matrix.adj', 'matrix.invertible?', 'linear-algebra.solve', 'matrix.mul', 'matrix.orthogonal-matrix?'],
|
|
21111
20798
|
},
|
|
21112
20799
|
'adj': {
|
|
21113
20800
|
category: 'matrix',
|
|
@@ -21244,7 +20931,7 @@ const moduleDocs$1 = {
|
|
|
21244
20931
|
'let { symmetric? } = import(matrix);\nsymmetric?([[1, 2], [2, 1]])',
|
|
21245
20932
|
'let { symmetric? } = import(matrix);\nsymmetric?([[1, 2, 3], [2, 1, 4], [3, 4, 1]])',
|
|
21246
20933
|
],
|
|
21247
|
-
seeAlso: ['matrix.orthogonal?', 'matrix.diagonal?', 'matrix.square?', 'matrix.hilbert'],
|
|
20934
|
+
seeAlso: ['matrix.orthogonal-matrix?', 'matrix.diagonal?', 'matrix.square?', 'matrix.hilbert'],
|
|
21248
20935
|
},
|
|
21249
20936
|
'triangular?': {
|
|
21250
20937
|
category: 'matrix',
|
|
@@ -21373,7 +21060,7 @@ const moduleDocs$1 = {
|
|
|
21373
21060
|
],
|
|
21374
21061
|
seeAlso: ['matrix.symmetric?', 'matrix.identity?', 'matrix.invertible?'],
|
|
21375
21062
|
},
|
|
21376
|
-
'orthogonal?': {
|
|
21063
|
+
'orthogonal-matrix?': {
|
|
21377
21064
|
category: 'matrix',
|
|
21378
21065
|
description: 'Checks if a `matrix` is **orthogonal**.',
|
|
21379
21066
|
returns: {
|
|
@@ -21393,9 +21080,9 @@ const moduleDocs$1 = {
|
|
|
21393
21080
|
},
|
|
21394
21081
|
],
|
|
21395
21082
|
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]])',
|
|
21083
|
+
'let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 0], [0, 1]])',
|
|
21084
|
+
'let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 0], [0, -1]])',
|
|
21085
|
+
'let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 2], [3, 4]])',
|
|
21399
21086
|
],
|
|
21400
21087
|
seeAlso: ['matrix.symmetric?', 'matrix.inv', 'matrix.identity?', 'linear-algebra.orthogonal?'],
|
|
21401
21088
|
},
|
|
@@ -21423,7 +21110,7 @@ const moduleDocs$1 = {
|
|
|
21423
21110
|
'let { identity? } = import(matrix);\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 1]])',
|
|
21424
21111
|
'let { identity? } = import(matrix);\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 0]])',
|
|
21425
21112
|
],
|
|
21426
|
-
seeAlso: ['matrix.diagonal?', 'matrix.square?', 'matrix.orthogonal?'],
|
|
21113
|
+
seeAlso: ['matrix.diagonal?', 'matrix.square?', 'matrix.orthogonal-matrix?'],
|
|
21427
21114
|
},
|
|
21428
21115
|
'invertible?': {
|
|
21429
21116
|
category: 'matrix',
|
|
@@ -22195,7 +21882,7 @@ const matrixNormalExpression = {
|
|
|
22195
21882
|
},
|
|
22196
21883
|
arity: toFixedArity(1),
|
|
22197
21884
|
},
|
|
22198
|
-
'orthogonal?': {
|
|
21885
|
+
'orthogonal-matrix?': {
|
|
22199
21886
|
evaluate: ([matrix], sourceCodeInfo) => {
|
|
22200
21887
|
assertMatrix(matrix, sourceCodeInfo);
|
|
22201
21888
|
return isOrthogonal(matrix);
|
|
@@ -29431,12 +29118,18 @@ const mathUtilsFunctions = {
|
|
|
29431
29118
|
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
29119
|
seeAlso: ['math.asin', 'math.sinh', 'math.cos', 'math.tan', 'math.to-rad'],
|
|
29433
29120
|
examples: [
|
|
29434
|
-
|
|
29435
|
-
|
|
29436
|
-
|
|
29437
|
-
|
|
29438
|
-
|
|
29439
|
-
|
|
29121
|
+
`let { sin } = import(math);
|
|
29122
|
+
sin(0)`,
|
|
29123
|
+
`let { sin } = import(math);
|
|
29124
|
+
sin(1)`,
|
|
29125
|
+
`let { sin } = import(math);
|
|
29126
|
+
sin(PI)`,
|
|
29127
|
+
`let { sin } = import(math);
|
|
29128
|
+
sin(-0.5)`,
|
|
29129
|
+
`let { sin } = import(math);
|
|
29130
|
+
sin([1, 2, 3])`,
|
|
29131
|
+
`let { sin } = import(math);
|
|
29132
|
+
sin([[1, 2], [3, 4]])`,
|
|
29440
29133
|
],
|
|
29441
29134
|
},
|
|
29442
29135
|
},
|
|
@@ -29453,11 +29146,16 @@ const mathUtilsFunctions = {
|
|
|
29453
29146
|
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
29147
|
seeAlso: ['math.sin', 'math.asinh', 'math.acos', 'math.atan'],
|
|
29455
29148
|
examples: [
|
|
29456
|
-
|
|
29457
|
-
|
|
29458
|
-
|
|
29459
|
-
|
|
29460
|
-
|
|
29149
|
+
`let { asin } = import(math);
|
|
29150
|
+
asin(0)`,
|
|
29151
|
+
`let { asin } = import(math);
|
|
29152
|
+
asin(1)`,
|
|
29153
|
+
`let { asin } = import(math);
|
|
29154
|
+
asin(-0.5)`,
|
|
29155
|
+
`let { asin } = import(math);
|
|
29156
|
+
asin([1, 2, 3])`,
|
|
29157
|
+
`let { asin } = import(math);
|
|
29158
|
+
asin([[1, 2], [3, 4]])`,
|
|
29461
29159
|
],
|
|
29462
29160
|
},
|
|
29463
29161
|
},
|
|
@@ -29474,11 +29172,16 @@ const mathUtilsFunctions = {
|
|
|
29474
29172
|
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
29173
|
seeAlso: ['math.asinh', 'math.sin', 'math.cosh', 'math.tanh'],
|
|
29476
29174
|
examples: [
|
|
29477
|
-
|
|
29478
|
-
|
|
29479
|
-
|
|
29480
|
-
|
|
29481
|
-
|
|
29175
|
+
`let { sinh } = import(math);
|
|
29176
|
+
sinh(0)`,
|
|
29177
|
+
`let { sinh } = import(math);
|
|
29178
|
+
sinh(1)`,
|
|
29179
|
+
`let { sinh } = import(math);
|
|
29180
|
+
sinh(-0.5)`,
|
|
29181
|
+
`let { sinh } = import(math);
|
|
29182
|
+
sinh([0.1, 0.2, 0.3])`,
|
|
29183
|
+
`let { sinh } = import(math);
|
|
29184
|
+
sinh([[0.1, 0.2], [0.3, 0.4]])`,
|
|
29482
29185
|
],
|
|
29483
29186
|
},
|
|
29484
29187
|
},
|
|
@@ -29495,11 +29198,16 @@ const mathUtilsFunctions = {
|
|
|
29495
29198
|
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
29199
|
seeAlso: ['math.sinh', 'math.asin', 'math.acosh', 'math.atanh'],
|
|
29497
29200
|
examples: [
|
|
29498
|
-
|
|
29499
|
-
|
|
29500
|
-
|
|
29501
|
-
|
|
29502
|
-
|
|
29201
|
+
`let { asinh } = import(math);
|
|
29202
|
+
asinh(10)`,
|
|
29203
|
+
`let { asinh } = import(math);
|
|
29204
|
+
asinh(90)`,
|
|
29205
|
+
`let { asinh } = import(math);
|
|
29206
|
+
asinh(50)`,
|
|
29207
|
+
`let { asinh } = import(math);
|
|
29208
|
+
asinh([10, 20, 30])`,
|
|
29209
|
+
`let { asinh } = import(math);
|
|
29210
|
+
asinh([[10, 20], [30, 40]])`,
|
|
29503
29211
|
],
|
|
29504
29212
|
},
|
|
29505
29213
|
},
|
|
@@ -29516,12 +29224,18 @@ const mathUtilsFunctions = {
|
|
|
29516
29224
|
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
29225
|
seeAlso: ['math.acos', 'math.cosh', 'math.sin', 'math.tan', 'math.to-rad'],
|
|
29518
29226
|
examples: [
|
|
29519
|
-
|
|
29520
|
-
|
|
29521
|
-
|
|
29522
|
-
|
|
29523
|
-
|
|
29524
|
-
|
|
29227
|
+
`let { cos } = import(math);
|
|
29228
|
+
cos(0)`,
|
|
29229
|
+
`let { cos } = import(math);
|
|
29230
|
+
cos(1)`,
|
|
29231
|
+
`let { cos } = import(math);
|
|
29232
|
+
cos(PI)`,
|
|
29233
|
+
`let { cos } = import(math);
|
|
29234
|
+
cos(-0.5)`,
|
|
29235
|
+
`let { cos } = import(math);
|
|
29236
|
+
cos([1, 2, 3])`,
|
|
29237
|
+
`let { cos } = import(math);
|
|
29238
|
+
cos([[1, 2], [3, 4]])`,
|
|
29525
29239
|
],
|
|
29526
29240
|
},
|
|
29527
29241
|
},
|
|
@@ -29538,11 +29252,16 @@ const mathUtilsFunctions = {
|
|
|
29538
29252
|
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
29253
|
seeAlso: ['math.cos', 'math.acosh', 'math.asin', 'math.atan'],
|
|
29540
29254
|
examples: [
|
|
29541
|
-
|
|
29542
|
-
|
|
29543
|
-
|
|
29544
|
-
|
|
29545
|
-
|
|
29255
|
+
`let { acos } = import(math);
|
|
29256
|
+
acos(0)`,
|
|
29257
|
+
`let { acos } = import(math);
|
|
29258
|
+
acos(1)`,
|
|
29259
|
+
`let { acos } = import(math);
|
|
29260
|
+
acos(-0.5)`,
|
|
29261
|
+
`let { acos } = import(math);
|
|
29262
|
+
acos([0.1, 0.2, 0.3])`,
|
|
29263
|
+
`let { acos } = import(math);
|
|
29264
|
+
acos([[0.1, 0.2], [0.3, 0.4]])`,
|
|
29546
29265
|
],
|
|
29547
29266
|
},
|
|
29548
29267
|
},
|
|
@@ -29559,11 +29278,16 @@ const mathUtilsFunctions = {
|
|
|
29559
29278
|
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
29279
|
seeAlso: ['math.acosh', 'math.cos', 'math.sinh', 'math.tanh'],
|
|
29561
29280
|
examples: [
|
|
29562
|
-
|
|
29563
|
-
|
|
29564
|
-
|
|
29565
|
-
|
|
29566
|
-
|
|
29281
|
+
`let { cosh } = import(math);
|
|
29282
|
+
cosh(0)`,
|
|
29283
|
+
`let { cosh } = import(math);
|
|
29284
|
+
cosh(1)`,
|
|
29285
|
+
`let { cosh } = import(math);
|
|
29286
|
+
cosh(-0.5)`,
|
|
29287
|
+
`let { cosh } = import(math);
|
|
29288
|
+
cosh([0.1, 0.2, 0.3])`,
|
|
29289
|
+
`let { cosh } = import(math);
|
|
29290
|
+
cosh([[0.1, 0.2], [0.3, 0.4]])`,
|
|
29567
29291
|
],
|
|
29568
29292
|
},
|
|
29569
29293
|
},
|
|
@@ -29580,12 +29304,18 @@ const mathUtilsFunctions = {
|
|
|
29580
29304
|
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
29305
|
seeAlso: ['math.cosh', 'math.acos', 'math.asinh', 'math.atanh'],
|
|
29582
29306
|
examples: [
|
|
29583
|
-
|
|
29584
|
-
|
|
29585
|
-
|
|
29586
|
-
|
|
29587
|
-
|
|
29588
|
-
|
|
29307
|
+
`let { acosh } = import(math);
|
|
29308
|
+
acosh(1)`,
|
|
29309
|
+
`let { acosh } = import(math);
|
|
29310
|
+
acosh(2)`,
|
|
29311
|
+
`let { acosh } = import(math);
|
|
29312
|
+
acosh(100)`,
|
|
29313
|
+
`let { acosh } = import(math);
|
|
29314
|
+
acosh(50)`,
|
|
29315
|
+
`let { acosh } = import(math);
|
|
29316
|
+
acosh([1, 2, 3])`,
|
|
29317
|
+
`let { acosh } = import(math);
|
|
29318
|
+
acosh([[1, 2], [3, 4]])`,
|
|
29589
29319
|
],
|
|
29590
29320
|
},
|
|
29591
29321
|
},
|
|
@@ -29602,12 +29332,18 @@ const mathUtilsFunctions = {
|
|
|
29602
29332
|
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
29333
|
seeAlso: ['math.atan', 'math.tanh', 'math.sin', 'math.cos', 'math.to-rad'],
|
|
29604
29334
|
examples: [
|
|
29605
|
-
|
|
29606
|
-
|
|
29607
|
-
|
|
29608
|
-
|
|
29609
|
-
|
|
29610
|
-
|
|
29335
|
+
`let { tan } = import(math);
|
|
29336
|
+
tan(0)`,
|
|
29337
|
+
`let { tan } = import(math);
|
|
29338
|
+
tan(1)`,
|
|
29339
|
+
`let { tan } = import(math);
|
|
29340
|
+
tan(PI)`,
|
|
29341
|
+
`let { tan } = import(math);
|
|
29342
|
+
tan(-0.5)`,
|
|
29343
|
+
`let { tan } = import(math);
|
|
29344
|
+
tan([1, 2, 3])`,
|
|
29345
|
+
`let { tan } = import(math);
|
|
29346
|
+
tan([[1, 2], [3, 4]])`,
|
|
29611
29347
|
],
|
|
29612
29348
|
},
|
|
29613
29349
|
},
|
|
@@ -29624,11 +29360,16 @@ const mathUtilsFunctions = {
|
|
|
29624
29360
|
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
29361
|
seeAlso: ['math.tan', 'math.atanh', 'math.asin', 'math.acos'],
|
|
29626
29362
|
examples: [
|
|
29627
|
-
|
|
29628
|
-
|
|
29629
|
-
|
|
29630
|
-
|
|
29631
|
-
|
|
29363
|
+
`let { atan } = import(math);
|
|
29364
|
+
atan(0)`,
|
|
29365
|
+
`let { atan } = import(math);
|
|
29366
|
+
atan(1)`,
|
|
29367
|
+
`let { atan } = import(math);
|
|
29368
|
+
atan(-0.5)`,
|
|
29369
|
+
`let { atan } = import(math);
|
|
29370
|
+
atan([0.1, 0.2, 0.3])`,
|
|
29371
|
+
`let { atan } = import(math);
|
|
29372
|
+
atan([[0.1, 0.2], [0.3, 0.4]])`,
|
|
29632
29373
|
],
|
|
29633
29374
|
},
|
|
29634
29375
|
},
|
|
@@ -29645,10 +29386,14 @@ const mathUtilsFunctions = {
|
|
|
29645
29386
|
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
29387
|
seeAlso: ['math.atanh', 'math.tan', 'math.sinh', 'math.cosh'],
|
|
29647
29388
|
examples: [
|
|
29648
|
-
|
|
29649
|
-
|
|
29650
|
-
|
|
29651
|
-
|
|
29389
|
+
`let { tanh } = import(math);
|
|
29390
|
+
tanh(0)`,
|
|
29391
|
+
`let { tanh } = import(math);
|
|
29392
|
+
tanh(1)`,
|
|
29393
|
+
`let { tanh } = import(math);
|
|
29394
|
+
tanh(-0.5)`,
|
|
29395
|
+
`let { tanh } = import(math);
|
|
29396
|
+
tanh(50)`,
|
|
29652
29397
|
],
|
|
29653
29398
|
},
|
|
29654
29399
|
},
|
|
@@ -29665,11 +29410,16 @@ const mathUtilsFunctions = {
|
|
|
29665
29410
|
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
29411
|
seeAlso: ['math.tanh', 'math.atan', 'math.asinh', 'math.acosh'],
|
|
29667
29412
|
examples: [
|
|
29668
|
-
|
|
29669
|
-
|
|
29670
|
-
|
|
29671
|
-
|
|
29672
|
-
|
|
29413
|
+
`let { atanh } = import(math);
|
|
29414
|
+
atanh(0)`,
|
|
29415
|
+
`let { atanh } = import(math);
|
|
29416
|
+
atanh(0.9)`,
|
|
29417
|
+
`let { atanh } = import(math);
|
|
29418
|
+
atanh(-0.5)`,
|
|
29419
|
+
`let { atanh } = import(math);
|
|
29420
|
+
atanh([0.1, 0.2, 0.3])`,
|
|
29421
|
+
`let { atanh } = import(math);
|
|
29422
|
+
atanh([[0.1, 0.2], [0.3, 0.4]])`,
|
|
29673
29423
|
],
|
|
29674
29424
|
},
|
|
29675
29425
|
},
|
|
@@ -29686,11 +29436,16 @@ const mathUtilsFunctions = {
|
|
|
29686
29436
|
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
29437
|
seeAlso: ['math.log2', 'math.log10', '^'],
|
|
29688
29438
|
examples: [
|
|
29689
|
-
|
|
29690
|
-
|
|
29691
|
-
|
|
29692
|
-
|
|
29693
|
-
|
|
29439
|
+
`let { ln } = import(math);
|
|
29440
|
+
ln(0.01)`,
|
|
29441
|
+
`let { ln } = import(math);
|
|
29442
|
+
ln(2.5)`,
|
|
29443
|
+
`let { ln } = import(math);
|
|
29444
|
+
ln(E)`,
|
|
29445
|
+
`let { ln } = import(math);
|
|
29446
|
+
ln([1, 2, 3])`,
|
|
29447
|
+
`let { ln } = import(math);
|
|
29448
|
+
ln([[1, 2], [3, 4]])`,
|
|
29694
29449
|
],
|
|
29695
29450
|
},
|
|
29696
29451
|
},
|
|
@@ -29707,11 +29462,16 @@ const mathUtilsFunctions = {
|
|
|
29707
29462
|
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
29463
|
seeAlso: ['math.ln', 'math.log10'],
|
|
29709
29464
|
examples: [
|
|
29710
|
-
|
|
29711
|
-
|
|
29712
|
-
|
|
29713
|
-
|
|
29714
|
-
|
|
29465
|
+
`let { log2 } = import(math);
|
|
29466
|
+
log2(0.01)`,
|
|
29467
|
+
`let { log2 } = import(math);
|
|
29468
|
+
log2(2 ^ 12)`,
|
|
29469
|
+
`let { log2 } = import(math);
|
|
29470
|
+
log2(2.5)`,
|
|
29471
|
+
`let { log2 } = import(math);
|
|
29472
|
+
log2([1, 2, 3])`,
|
|
29473
|
+
`let { log2 } = import(math);
|
|
29474
|
+
log2([[1, 2], [3, 4]])`,
|
|
29715
29475
|
],
|
|
29716
29476
|
},
|
|
29717
29477
|
},
|
|
@@ -29728,11 +29488,16 @@ const mathUtilsFunctions = {
|
|
|
29728
29488
|
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
29489
|
seeAlso: ['math.ln', 'math.log2'],
|
|
29730
29490
|
examples: [
|
|
29731
|
-
|
|
29732
|
-
|
|
29733
|
-
|
|
29734
|
-
|
|
29735
|
-
|
|
29491
|
+
`let { log10 } = import(math);
|
|
29492
|
+
log10(0.01)`,
|
|
29493
|
+
`let { log10 } = import(math);
|
|
29494
|
+
log10(10 ^ 12)`,
|
|
29495
|
+
`let { log10 } = import(math);
|
|
29496
|
+
log10(2.5)`,
|
|
29497
|
+
`let { log10 } = import(math);
|
|
29498
|
+
log10([1, 2, 3])`,
|
|
29499
|
+
`let { log10 } = import(math);
|
|
29500
|
+
log10([[1, 2], [3, 4]])`,
|
|
29736
29501
|
],
|
|
29737
29502
|
},
|
|
29738
29503
|
},
|
|
@@ -29749,12 +29514,18 @@ const mathUtilsFunctions = {
|
|
|
29749
29514
|
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
29515
|
seeAlso: ['math.to-deg', 'math.sin', 'math.cos', 'math.tan'],
|
|
29751
29516
|
examples: [
|
|
29752
|
-
|
|
29753
|
-
|
|
29754
|
-
|
|
29755
|
-
|
|
29756
|
-
|
|
29757
|
-
|
|
29517
|
+
`let { to-rad } = import(math);
|
|
29518
|
+
to-rad(0)`,
|
|
29519
|
+
`let { to-rad } = import(math);
|
|
29520
|
+
to-rad(90)`,
|
|
29521
|
+
`let { to-rad } = import(math);
|
|
29522
|
+
to-rad(180)`,
|
|
29523
|
+
`let { to-rad } = import(math);
|
|
29524
|
+
to-rad(360)`,
|
|
29525
|
+
`let { to-rad } = import(math);
|
|
29526
|
+
to-rad([0, 90, 180])`,
|
|
29527
|
+
`let { to-rad } = import(math);
|
|
29528
|
+
to-rad([[0, 90], [180, 360]])`,
|
|
29758
29529
|
],
|
|
29759
29530
|
},
|
|
29760
29531
|
},
|
|
@@ -29771,12 +29542,18 @@ const mathUtilsFunctions = {
|
|
|
29771
29542
|
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
29543
|
seeAlso: ['math.to-rad'],
|
|
29773
29544
|
examples: [
|
|
29774
|
-
|
|
29775
|
-
|
|
29776
|
-
|
|
29777
|
-
|
|
29778
|
-
|
|
29779
|
-
|
|
29545
|
+
`let { to-deg } = import(math);
|
|
29546
|
+
to-deg(0)`,
|
|
29547
|
+
`let { to-deg } = import(math);
|
|
29548
|
+
to-deg(PI)`,
|
|
29549
|
+
`let { to-deg } = import(math);
|
|
29550
|
+
to-deg(PI / 2)`,
|
|
29551
|
+
`let { to-deg } = import(math);
|
|
29552
|
+
to-deg(3 * PI / 2)`,
|
|
29553
|
+
`let { to-deg } = import(math);
|
|
29554
|
+
to-deg([0, PI, PI / 2])`,
|
|
29555
|
+
`let { to-deg } = import(math);
|
|
29556
|
+
to-deg([[0, PI], [PI / 2, 3 * PI / 2]])`,
|
|
29780
29557
|
],
|
|
29781
29558
|
},
|
|
29782
29559
|
},
|
|
@@ -30009,9 +29786,12 @@ const stringUtilsFunctions = {
|
|
|
30009
29786
|
description: 'Repeates $s $n times.',
|
|
30010
29787
|
seeAlso: ['str', 'repeat'],
|
|
30011
29788
|
examples: [
|
|
30012
|
-
|
|
30013
|
-
|
|
30014
|
-
|
|
29789
|
+
`let { string-repeat } = import(string);
|
|
29790
|
+
"*" string-repeat 10`,
|
|
29791
|
+
`let { string-repeat } = import(string);
|
|
29792
|
+
string-repeat("*", 10)`,
|
|
29793
|
+
`let { string-repeat } = import(string);
|
|
29794
|
+
string-repeat("***", 0)`,
|
|
30015
29795
|
],
|
|
30016
29796
|
},
|
|
30017
29797
|
},
|
|
@@ -30035,8 +29815,10 @@ const stringUtilsFunctions = {
|
|
|
30035
29815
|
description: 'Return character for code point $code.',
|
|
30036
29816
|
seeAlso: ['string.to-char-code'],
|
|
30037
29817
|
examples: [
|
|
30038
|
-
|
|
30039
|
-
|
|
29818
|
+
`let { from-char-code } = import(string);
|
|
29819
|
+
from-char-code(65)`,
|
|
29820
|
+
`let { from-char-code } = import(string);
|
|
29821
|
+
from-char-code(0)`,
|
|
30040
29822
|
],
|
|
30041
29823
|
},
|
|
30042
29824
|
},
|
|
@@ -30054,8 +29836,10 @@ const stringUtilsFunctions = {
|
|
|
30054
29836
|
description: 'Return code point for first character in $c.',
|
|
30055
29837
|
seeAlso: ['string.from-char-code'],
|
|
30056
29838
|
examples: [
|
|
30057
|
-
|
|
30058
|
-
|
|
29839
|
+
`let { to-char-code } = import(string);
|
|
29840
|
+
to-char-code("A")`,
|
|
29841
|
+
`let { to-char-code } = import(string);
|
|
29842
|
+
to-char-code("Albert")`,
|
|
30059
29843
|
],
|
|
30060
29844
|
},
|
|
30061
29845
|
},
|
|
@@ -30073,9 +29857,12 @@ const stringUtilsFunctions = {
|
|
|
30073
29857
|
description: 'Returns a new string with leading whitespaces removed.',
|
|
30074
29858
|
seeAlso: ['trim', 'string.trim-right'],
|
|
30075
29859
|
examples: [
|
|
30076
|
-
|
|
30077
|
-
|
|
30078
|
-
|
|
29860
|
+
`let { trim-left } = import(string);
|
|
29861
|
+
trim-left(" Albert ")`,
|
|
29862
|
+
`let { trim-left } = import(string);
|
|
29863
|
+
trim-left(" ")`,
|
|
29864
|
+
`let { trim-left } = import(string);
|
|
29865
|
+
trim-left("")`,
|
|
30079
29866
|
],
|
|
30080
29867
|
},
|
|
30081
29868
|
},
|
|
@@ -30093,9 +29880,12 @@ const stringUtilsFunctions = {
|
|
|
30093
29880
|
description: 'Returns a new string with trailing whitespaces removed.',
|
|
30094
29881
|
seeAlso: ['trim', 'string.trim-left'],
|
|
30095
29882
|
examples: [
|
|
30096
|
-
|
|
30097
|
-
|
|
30098
|
-
|
|
29883
|
+
`let { trim-right } = import(string);
|
|
29884
|
+
trim-right(" Albert ")`,
|
|
29885
|
+
`let { trim-right } = import(string);
|
|
29886
|
+
trim-right(" ")`,
|
|
29887
|
+
`let { trim-right } = import(string);
|
|
29888
|
+
trim-right("")`,
|
|
30099
29889
|
],
|
|
30100
29890
|
},
|
|
30101
29891
|
},
|
|
@@ -30113,10 +29903,14 @@ const stringUtilsFunctions = {
|
|
|
30113
29903
|
description: 'Divides $s into an array of substrings, each representing a line.',
|
|
30114
29904
|
seeAlso: ['split'],
|
|
30115
29905
|
examples: [
|
|
30116
|
-
|
|
30117
|
-
|
|
30118
|
-
|
|
30119
|
-
|
|
29906
|
+
`let { split-lines } = import(string);
|
|
29907
|
+
split-lines("Albert\nMojir\n")`,
|
|
29908
|
+
`let { split-lines } = import(string);
|
|
29909
|
+
split-lines("Albert\n\nMojir")`,
|
|
29910
|
+
`let { split-lines } = import(string);
|
|
29911
|
+
split-lines("Albert\nMojir\n\n")`,
|
|
29912
|
+
`let { split-lines } = import(string);
|
|
29913
|
+
split-lines("")`,
|
|
30120
29914
|
],
|
|
30121
29915
|
},
|
|
30122
29916
|
},
|
|
@@ -30146,11 +29940,16 @@ const stringUtilsFunctions = {
|
|
|
30146
29940
|
description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given $length.',
|
|
30147
29941
|
seeAlso: ['string.pad-right'],
|
|
30148
29942
|
examples: [
|
|
30149
|
-
|
|
30150
|
-
|
|
30151
|
-
|
|
30152
|
-
|
|
30153
|
-
|
|
29943
|
+
`let { pad-left } = import(string);
|
|
29944
|
+
"Albert" pad-left 20`,
|
|
29945
|
+
`let { pad-left } = import(string);
|
|
29946
|
+
pad-left("Albert", 20)`,
|
|
29947
|
+
`let { pad-left } = import(string);
|
|
29948
|
+
pad-left("Albert", 20, "-*-")`,
|
|
29949
|
+
`let { pad-left } = import(string);
|
|
29950
|
+
pad-left("Albert", 5)`,
|
|
29951
|
+
`let { pad-left } = import(string);
|
|
29952
|
+
pad-left("Albert", -1)`,
|
|
30154
29953
|
],
|
|
30155
29954
|
},
|
|
30156
29955
|
},
|
|
@@ -30180,11 +29979,16 @@ const stringUtilsFunctions = {
|
|
|
30180
29979
|
description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given `length`.',
|
|
30181
29980
|
seeAlso: ['string.pad-left'],
|
|
30182
29981
|
examples: [
|
|
30183
|
-
|
|
30184
|
-
|
|
30185
|
-
|
|
30186
|
-
|
|
30187
|
-
|
|
29982
|
+
`let { pad-right } = import(string);
|
|
29983
|
+
"Albert" pad-right 20`,
|
|
29984
|
+
`let { pad-right } = import(string);
|
|
29985
|
+
pad-right("Albert", 20)`,
|
|
29986
|
+
`let { pad-right } = import(string);
|
|
29987
|
+
pad-right("Albert", 20, "-*-")`,
|
|
29988
|
+
`let { pad-right } = import(string);
|
|
29989
|
+
pad-right("Albert", 5)`,
|
|
29990
|
+
`let { pad-right } = import(string);
|
|
29991
|
+
pad-right("Albert", -1)`,
|
|
30188
29992
|
],
|
|
30189
29993
|
},
|
|
30190
29994
|
},
|
|
@@ -30228,19 +30032,32 @@ const stringUtilsFunctions = {
|
|
|
30228
30032
|
description: 'Applies placeholders to a string. Support for basic pluralization - see examples. If pluralization is used, first placeholder must be a number.',
|
|
30229
30033
|
seeAlso: ['str'],
|
|
30230
30034
|
examples: [
|
|
30231
|
-
|
|
30232
|
-
|
|
30233
|
-
|
|
30234
|
-
|
|
30235
|
-
|
|
30236
|
-
|
|
30237
|
-
|
|
30238
|
-
|
|
30239
|
-
|
|
30240
|
-
|
|
30241
|
-
|
|
30242
|
-
|
|
30243
|
-
|
|
30035
|
+
`let { template } = import(string);
|
|
30036
|
+
template("Hi, $1 and $2", "Carl", "Larry")`,
|
|
30037
|
+
`let { template } = import(string);
|
|
30038
|
+
template("Hi $1, $2, $3, $4, $5, $6, $7, $8 and $9", "A", "B", "C", "D", "E", "F", "G", "H", "I")`,
|
|
30039
|
+
`let { template } = import(string);
|
|
30040
|
+
template("$1 book||||$1 books", 0)`,
|
|
30041
|
+
`let { template } = import(string);
|
|
30042
|
+
template("$1 book||||$1 books", 1)`,
|
|
30043
|
+
`let { template } = import(string);
|
|
30044
|
+
template("$1 book||||$1 books", 2)`,
|
|
30045
|
+
`let { template } = import(string);
|
|
30046
|
+
template("No book||||$1 book||||$1 books", 0)`,
|
|
30047
|
+
`let { template } = import(string);
|
|
30048
|
+
template("No book||||$1 book||||$1 books", 1)`,
|
|
30049
|
+
`let { template } = import(string);
|
|
30050
|
+
template("No book||||$1 book||||$1 books", 10)`,
|
|
30051
|
+
`let { template } = import(string);
|
|
30052
|
+
template("No book||||One book||||Two books||||Three books||||$1 books", 0)`,
|
|
30053
|
+
`let { template } = import(string);
|
|
30054
|
+
template("No book||||One book||||Two books||||Three books||||$1 books", 1)`,
|
|
30055
|
+
`let { template } = import(string);
|
|
30056
|
+
template("No book||||One book||||Two books||||Three books||||$1 books", 2)`,
|
|
30057
|
+
`let { template } = import(string);
|
|
30058
|
+
template("No book||||One book||||Two books||||Three books||||$1 books", 3)`,
|
|
30059
|
+
`let { template } = import(string);
|
|
30060
|
+
template("No book||||One book||||Two books||||Three books||||$1 books", 4)`,
|
|
30244
30061
|
],
|
|
30245
30062
|
hideOperatorForm: true,
|
|
30246
30063
|
},
|
|
@@ -30262,7 +30079,8 @@ const stringUtilsFunctions = {
|
|
|
30262
30079
|
description: 'Returns a Base64 encoded string from $s.',
|
|
30263
30080
|
seeAlso: ['string.decode-base64'],
|
|
30264
30081
|
examples: [
|
|
30265
|
-
|
|
30082
|
+
`let { encode-base64 } = import(string);
|
|
30083
|
+
encode-base64("Albert")`,
|
|
30266
30084
|
],
|
|
30267
30085
|
},
|
|
30268
30086
|
},
|
|
@@ -30290,7 +30108,8 @@ const stringUtilsFunctions = {
|
|
|
30290
30108
|
description: 'Returns a Base64 decoded string from $base64string.',
|
|
30291
30109
|
seeAlso: ['string.encode-base64'],
|
|
30292
30110
|
examples: [
|
|
30293
|
-
|
|
30111
|
+
`let { decode-base64 } = import(string);
|
|
30112
|
+
decode-base64("QWxiZXJ0IPCfkLs=")`,
|
|
30294
30113
|
],
|
|
30295
30114
|
},
|
|
30296
30115
|
},
|
|
@@ -30308,7 +30127,8 @@ const stringUtilsFunctions = {
|
|
|
30308
30127
|
description: 'Returns an escaped `URI` string.',
|
|
30309
30128
|
seeAlso: ['string.decode-uri-component'],
|
|
30310
30129
|
examples: [
|
|
30311
|
-
|
|
30130
|
+
`let { encode-uri-component } = import(string);
|
|
30131
|
+
encode-uri-component("Hi everyone!?")`,
|
|
30312
30132
|
],
|
|
30313
30133
|
},
|
|
30314
30134
|
},
|
|
@@ -30331,7 +30151,8 @@ const stringUtilsFunctions = {
|
|
|
30331
30151
|
description: 'Returns an un-escaped `URI` string.',
|
|
30332
30152
|
seeAlso: ['string.encode-uri-component'],
|
|
30333
30153
|
examples: [
|
|
30334
|
-
|
|
30154
|
+
`let { decode-uri-component } = import(string);
|
|
30155
|
+
decode-uri-component("Hi%20everyone!%3F%20%F0%9F%91%8D")`,
|
|
30335
30156
|
],
|
|
30336
30157
|
},
|
|
30337
30158
|
},
|
|
@@ -30349,10 +30170,14 @@ const stringUtilsFunctions = {
|
|
|
30349
30170
|
description: 'Returns $s with the first character converted to uppercase and the rest to lowercase.',
|
|
30350
30171
|
seeAlso: ['lower-case', 'upper-case'],
|
|
30351
30172
|
examples: [
|
|
30352
|
-
|
|
30353
|
-
|
|
30354
|
-
|
|
30355
|
-
|
|
30173
|
+
`let { capitalize } = import(string);
|
|
30174
|
+
capitalize("albert")`,
|
|
30175
|
+
`let { capitalize } = import(string);
|
|
30176
|
+
capitalize("ALBERT")`,
|
|
30177
|
+
`let { capitalize } = import(string);
|
|
30178
|
+
capitalize("aLBERT")`,
|
|
30179
|
+
`let { capitalize } = import(string);
|
|
30180
|
+
capitalize("")`,
|
|
30356
30181
|
],
|
|
30357
30182
|
},
|
|
30358
30183
|
},
|
|
@@ -31066,7 +30891,7 @@ cu.reductions(
|
|
|
31066
30891
|
},
|
|
31067
30892
|
variants: [{ argumentNames: ['a', 'b'] }],
|
|
31068
30893
|
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?'],
|
|
30894
|
+
seeAlso: ['collection.any?', 'collection.not-every?', 'collection.not-any?', 'functional.every-pred', 'grid.cell-every?'],
|
|
31070
30895
|
examples: [
|
|
31071
30896
|
'let cu = import(collection); cu.every?([1, 2, 3], number?)',
|
|
31072
30897
|
'let cu = import(collection); cu.every?([1, 2, 3], even?)',
|
|
@@ -31354,29 +31179,6 @@ su.position(
|
|
|
31354
31179
|
],
|
|
31355
31180
|
},
|
|
31356
31181
|
},
|
|
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
31182
|
'splice': {
|
|
31381
31183
|
evaluate: (params, sourceCodeInfo) => {
|
|
31382
31184
|
const [seq, start, deleteCount, ...rest] = params;
|
|
@@ -31501,7 +31303,7 @@ su.position(
|
|
|
31501
31303
|
},
|
|
31502
31304
|
variants: [{ argumentNames: ['seq', 'values'] }],
|
|
31503
31305
|
description: 'Returns copy of $seq with $values added to the beginning.',
|
|
31504
|
-
seeAlso: ['push', '
|
|
31306
|
+
seeAlso: ['push', '++'],
|
|
31505
31307
|
examples: [
|
|
31506
31308
|
'let su = import(sequence); su.unshift([1, 2, 3], 4)',
|
|
31507
31309
|
'let su = import(sequence); su.unshift([1, 2, 3], 4)',
|
|
@@ -32174,6 +31976,380 @@ const bitwiseUtilsModule = {
|
|
|
32174
31976
|
functions: bitwiseUtilsNormalExpression,
|
|
32175
31977
|
};
|
|
32176
31978
|
|
|
31979
|
+
const lengthUnits = {
|
|
31980
|
+
baseUnit: 'm',
|
|
31981
|
+
description: 'length',
|
|
31982
|
+
units: {
|
|
31983
|
+
angstrom: 1e-10,
|
|
31984
|
+
um: 0.000001,
|
|
31985
|
+
mm: 0.001,
|
|
31986
|
+
cm: 0.01,
|
|
31987
|
+
m: 1,
|
|
31988
|
+
km: 1000,
|
|
31989
|
+
in: 0.0254,
|
|
31990
|
+
ft: 0.3048,
|
|
31991
|
+
yd: 0.9144,
|
|
31992
|
+
mi: 1609.344,
|
|
31993
|
+
nmi: 1852,
|
|
31994
|
+
},
|
|
31995
|
+
};
|
|
31996
|
+
const weightUnits = {
|
|
31997
|
+
baseUnit: 'kg',
|
|
31998
|
+
description: 'weight',
|
|
31999
|
+
units: {
|
|
32000
|
+
mg: 0.000001,
|
|
32001
|
+
g: 0.001,
|
|
32002
|
+
kg: 1,
|
|
32003
|
+
t: 1000,
|
|
32004
|
+
oz: 0.028349523125,
|
|
32005
|
+
lb: 0.45359237,
|
|
32006
|
+
st: 6.35029318,
|
|
32007
|
+
},
|
|
32008
|
+
};
|
|
32009
|
+
const volumeUnits = {
|
|
32010
|
+
baseUnit: 'l',
|
|
32011
|
+
description: 'volume',
|
|
32012
|
+
units: {
|
|
32013
|
+
'ml': 0.001,
|
|
32014
|
+
'cl': 0.01,
|
|
32015
|
+
'dl': 0.1,
|
|
32016
|
+
'l': 1,
|
|
32017
|
+
'tsp': 0.00492892159375,
|
|
32018
|
+
'tbsp': 0.01478676478125,
|
|
32019
|
+
'fl-oz': 0.0295735295625,
|
|
32020
|
+
'cup': 0.2365882365,
|
|
32021
|
+
'pt': 0.473176473,
|
|
32022
|
+
'qt': 0.946352946,
|
|
32023
|
+
'gal': 3.785411784,
|
|
32024
|
+
},
|
|
32025
|
+
};
|
|
32026
|
+
const timeUnits = {
|
|
32027
|
+
baseUnit: 's',
|
|
32028
|
+
description: 'time',
|
|
32029
|
+
units: {
|
|
32030
|
+
ms: 0.001,
|
|
32031
|
+
s: 1,
|
|
32032
|
+
min: 60,
|
|
32033
|
+
h: 3600,
|
|
32034
|
+
day: 86400,
|
|
32035
|
+
week: 604800,
|
|
32036
|
+
},
|
|
32037
|
+
};
|
|
32038
|
+
const areaUnits = {
|
|
32039
|
+
baseUnit: 'm2',
|
|
32040
|
+
description: 'area',
|
|
32041
|
+
units: {
|
|
32042
|
+
mm2: 0.000001,
|
|
32043
|
+
cm2: 0.0001,
|
|
32044
|
+
m2: 1,
|
|
32045
|
+
km2: 1000000,
|
|
32046
|
+
in2: 0.00064516,
|
|
32047
|
+
ft2: 0.09290304,
|
|
32048
|
+
yd2: 0.83612736,
|
|
32049
|
+
acre: 4046.8564224,
|
|
32050
|
+
hectare: 10000,
|
|
32051
|
+
},
|
|
32052
|
+
};
|
|
32053
|
+
const speedUnits = {
|
|
32054
|
+
baseUnit: 'm/s',
|
|
32055
|
+
description: 'speed',
|
|
32056
|
+
units: {
|
|
32057
|
+
'm/s': 1,
|
|
32058
|
+
'km/h': 1 / 3.6,
|
|
32059
|
+
'mph': 0.44704,
|
|
32060
|
+
'kn': 0.514444,
|
|
32061
|
+
'ft/s': 0.3048,
|
|
32062
|
+
},
|
|
32063
|
+
};
|
|
32064
|
+
const dataUnits = {
|
|
32065
|
+
baseUnit: 'b',
|
|
32066
|
+
description: 'data',
|
|
32067
|
+
units: {
|
|
32068
|
+
b: 1,
|
|
32069
|
+
kb: 1000,
|
|
32070
|
+
mb: 1000000,
|
|
32071
|
+
gb: 1e9,
|
|
32072
|
+
tb: 1e12,
|
|
32073
|
+
pb: 1e15,
|
|
32074
|
+
},
|
|
32075
|
+
};
|
|
32076
|
+
const pressureUnits = {
|
|
32077
|
+
baseUnit: 'pa',
|
|
32078
|
+
description: 'pressure',
|
|
32079
|
+
units: {
|
|
32080
|
+
pa: 1,
|
|
32081
|
+
kpa: 1000,
|
|
32082
|
+
bar: 100000,
|
|
32083
|
+
atm: 101325,
|
|
32084
|
+
psi: 6894.757293168,
|
|
32085
|
+
mmhg: 133.322387415,
|
|
32086
|
+
},
|
|
32087
|
+
};
|
|
32088
|
+
const energyUnits = {
|
|
32089
|
+
baseUnit: 'j',
|
|
32090
|
+
description: 'energy',
|
|
32091
|
+
units: {
|
|
32092
|
+
j: 1,
|
|
32093
|
+
kj: 1000,
|
|
32094
|
+
cal: 4.184,
|
|
32095
|
+
kcal: 4184,
|
|
32096
|
+
wh: 3600,
|
|
32097
|
+
kwh: 3600000,
|
|
32098
|
+
btu: 1055.06,
|
|
32099
|
+
},
|
|
32100
|
+
};
|
|
32101
|
+
const powerUnits = {
|
|
32102
|
+
baseUnit: 'w',
|
|
32103
|
+
description: 'power',
|
|
32104
|
+
units: {
|
|
32105
|
+
w: 1,
|
|
32106
|
+
kw: 1000,
|
|
32107
|
+
mw: 1000000,
|
|
32108
|
+
hp: 745.7,
|
|
32109
|
+
},
|
|
32110
|
+
};
|
|
32111
|
+
const frequencyUnits = {
|
|
32112
|
+
baseUnit: 'hz',
|
|
32113
|
+
description: 'frequency',
|
|
32114
|
+
units: {
|
|
32115
|
+
hz: 1,
|
|
32116
|
+
khz: 1000,
|
|
32117
|
+
mhz: 1000000,
|
|
32118
|
+
ghz: 1000000000,
|
|
32119
|
+
},
|
|
32120
|
+
};
|
|
32121
|
+
const angleUnits = {
|
|
32122
|
+
baseUnit: 'rad',
|
|
32123
|
+
description: 'angle',
|
|
32124
|
+
units: {
|
|
32125
|
+
deg: Math.PI / 180,
|
|
32126
|
+
rad: 1,
|
|
32127
|
+
grad: Math.PI / 200,
|
|
32128
|
+
turn: 2 * Math.PI,
|
|
32129
|
+
},
|
|
32130
|
+
};
|
|
32131
|
+
// --- Temperature conversion functions ---
|
|
32132
|
+
function celsiusTo(unit, value) {
|
|
32133
|
+
switch (unit) {
|
|
32134
|
+
case 'c': return value;
|
|
32135
|
+
case 'f': return value * 9 / 5 + 32;
|
|
32136
|
+
case 'k': return value + 273.15;
|
|
32137
|
+
}
|
|
32138
|
+
}
|
|
32139
|
+
function toCelsius(unit, value) {
|
|
32140
|
+
switch (unit) {
|
|
32141
|
+
case 'c': return value;
|
|
32142
|
+
case 'f': return (value - 32) * 5 / 9;
|
|
32143
|
+
case 'k': return value - 273.15;
|
|
32144
|
+
}
|
|
32145
|
+
}
|
|
32146
|
+
const temperatureUnits = ['c', 'f', 'k'];
|
|
32147
|
+
const unitDescriptions = {
|
|
32148
|
+
// Length
|
|
32149
|
+
'angstrom': 'ångströms',
|
|
32150
|
+
'um': 'micrometers',
|
|
32151
|
+
'mm': 'millimeters',
|
|
32152
|
+
'cm': 'centimeters',
|
|
32153
|
+
'm': 'meters',
|
|
32154
|
+
'km': 'kilometers',
|
|
32155
|
+
'in': 'inches',
|
|
32156
|
+
'ft': 'feet',
|
|
32157
|
+
'yd': 'yards',
|
|
32158
|
+
'mi': 'miles',
|
|
32159
|
+
'nmi': 'nautical miles',
|
|
32160
|
+
// Weight
|
|
32161
|
+
'mg': 'milligrams',
|
|
32162
|
+
'g': 'grams',
|
|
32163
|
+
'kg': 'kilograms',
|
|
32164
|
+
't': 'metric tons',
|
|
32165
|
+
'oz': 'ounces',
|
|
32166
|
+
'lb': 'pounds',
|
|
32167
|
+
'st': 'stones',
|
|
32168
|
+
// Volume
|
|
32169
|
+
'ml': 'milliliters',
|
|
32170
|
+
'cl': 'centiliters',
|
|
32171
|
+
'dl': 'deciliters',
|
|
32172
|
+
'l': 'liters',
|
|
32173
|
+
'tsp': 'teaspoons',
|
|
32174
|
+
'tbsp': 'tablespoons',
|
|
32175
|
+
'fl-oz': 'fluid ounces',
|
|
32176
|
+
'cup': 'cups',
|
|
32177
|
+
'pt': 'pints',
|
|
32178
|
+
'qt': 'quarts',
|
|
32179
|
+
'gal': 'gallons',
|
|
32180
|
+
// Time
|
|
32181
|
+
'ms': 'milliseconds',
|
|
32182
|
+
's': 'seconds',
|
|
32183
|
+
'min': 'minutes',
|
|
32184
|
+
'h': 'hours',
|
|
32185
|
+
'day': 'days',
|
|
32186
|
+
'week': 'weeks',
|
|
32187
|
+
// Area
|
|
32188
|
+
'mm2': 'square millimeters',
|
|
32189
|
+
'cm2': 'square centimeters',
|
|
32190
|
+
'm2': 'square meters',
|
|
32191
|
+
'km2': 'square kilometers',
|
|
32192
|
+
'in2': 'square inches',
|
|
32193
|
+
'ft2': 'square feet',
|
|
32194
|
+
'yd2': 'square yards',
|
|
32195
|
+
'acre': 'acres',
|
|
32196
|
+
'hectare': 'hectares',
|
|
32197
|
+
// Speed
|
|
32198
|
+
'm/s': 'meters per second',
|
|
32199
|
+
'km/h': 'kilometers per hour',
|
|
32200
|
+
'mph': 'miles per hour',
|
|
32201
|
+
'kn': 'knots',
|
|
32202
|
+
'ft/s': 'feet per second',
|
|
32203
|
+
// Data
|
|
32204
|
+
'b': 'bytes',
|
|
32205
|
+
'kb': 'kilobytes',
|
|
32206
|
+
'mb': 'megabytes',
|
|
32207
|
+
'gb': 'gigabytes',
|
|
32208
|
+
'tb': 'terabytes',
|
|
32209
|
+
'pb': 'petabytes',
|
|
32210
|
+
// Pressure
|
|
32211
|
+
'pa': 'pascals',
|
|
32212
|
+
'kpa': 'kilopascals',
|
|
32213
|
+
'bar': 'bars',
|
|
32214
|
+
'atm': 'atmospheres',
|
|
32215
|
+
'psi': 'pounds per square inch',
|
|
32216
|
+
'mmhg': 'millimeters of mercury',
|
|
32217
|
+
// Energy
|
|
32218
|
+
'j': 'joules',
|
|
32219
|
+
'kj': 'kilojoules',
|
|
32220
|
+
'cal': 'calories',
|
|
32221
|
+
'kcal': 'kilocalories',
|
|
32222
|
+
'wh': 'watt-hours',
|
|
32223
|
+
'kwh': 'kilowatt-hours',
|
|
32224
|
+
'btu': 'British thermal units',
|
|
32225
|
+
// Power
|
|
32226
|
+
'w': 'watts',
|
|
32227
|
+
'kw': 'kilowatts',
|
|
32228
|
+
'mw': 'megawatts',
|
|
32229
|
+
'hp': 'horsepower',
|
|
32230
|
+
// Frequency
|
|
32231
|
+
'hz': 'hertz',
|
|
32232
|
+
'khz': 'kilohertz',
|
|
32233
|
+
'mhz': 'megahertz',
|
|
32234
|
+
'ghz': 'gigahertz',
|
|
32235
|
+
// Angle
|
|
32236
|
+
'deg': 'degrees',
|
|
32237
|
+
'rad': 'radians',
|
|
32238
|
+
'grad': 'gradians',
|
|
32239
|
+
'turn': 'turns',
|
|
32240
|
+
// Temperature
|
|
32241
|
+
'c': 'Celsius',
|
|
32242
|
+
'f': 'Fahrenheit',
|
|
32243
|
+
'k': 'Kelvin',
|
|
32244
|
+
};
|
|
32245
|
+
// --- Generate linear conversion functions ---
|
|
32246
|
+
function generateLinearConversions(category) {
|
|
32247
|
+
const result = {};
|
|
32248
|
+
const unitNames = Object.keys(category.units);
|
|
32249
|
+
for (const from of unitNames) {
|
|
32250
|
+
for (const to of unitNames) {
|
|
32251
|
+
if (from === to)
|
|
32252
|
+
continue;
|
|
32253
|
+
const fromFactor = category.units[from];
|
|
32254
|
+
const toFactor = category.units[to];
|
|
32255
|
+
const conversionFactor = fromFactor / toFactor;
|
|
32256
|
+
const fnName = `${from}->${to}`;
|
|
32257
|
+
const fromDesc = unitDescriptions[from];
|
|
32258
|
+
const toDesc = unitDescriptions[to];
|
|
32259
|
+
const seeAlso = [
|
|
32260
|
+
`convert.${to}->${from}`,
|
|
32261
|
+
...unitNames
|
|
32262
|
+
.filter(u => u !== from && u !== to)
|
|
32263
|
+
.map(u => `convert.${from}->${u}`),
|
|
32264
|
+
];
|
|
32265
|
+
result[fnName] = {
|
|
32266
|
+
evaluate: ([value], sourceCodeInfo) => {
|
|
32267
|
+
assertNumber(value, sourceCodeInfo);
|
|
32268
|
+
return value * conversionFactor;
|
|
32269
|
+
},
|
|
32270
|
+
arity: toFixedArity(1),
|
|
32271
|
+
docs: {
|
|
32272
|
+
category: 'convert',
|
|
32273
|
+
returns: { type: 'number' },
|
|
32274
|
+
args: {
|
|
32275
|
+
value: { type: 'number', description: `Value in ${fromDesc}` },
|
|
32276
|
+
},
|
|
32277
|
+
variants: [{ argumentNames: ['value'] }],
|
|
32278
|
+
description: `Converts a value from ${fromDesc} (\`${from}\`) to ${toDesc} (\`${to}\`).`,
|
|
32279
|
+
seeAlso,
|
|
32280
|
+
examples: [
|
|
32281
|
+
`let { ${fnName} } = import(convert);
|
|
32282
|
+
${fnName}(1)`,
|
|
32283
|
+
],
|
|
32284
|
+
},
|
|
32285
|
+
};
|
|
32286
|
+
}
|
|
32287
|
+
}
|
|
32288
|
+
return result;
|
|
32289
|
+
}
|
|
32290
|
+
// --- Generate temperature conversion functions ---
|
|
32291
|
+
function generateTemperatureConversions() {
|
|
32292
|
+
const result = {};
|
|
32293
|
+
for (const from of temperatureUnits) {
|
|
32294
|
+
for (const to of temperatureUnits) {
|
|
32295
|
+
if (from === to)
|
|
32296
|
+
continue;
|
|
32297
|
+
const fnName = `${from}->${to}`;
|
|
32298
|
+
const fromDesc = unitDescriptions[from];
|
|
32299
|
+
const toDesc = unitDescriptions[to];
|
|
32300
|
+
const seeAlso = [
|
|
32301
|
+
`convert.${to}->${from}`,
|
|
32302
|
+
...temperatureUnits
|
|
32303
|
+
.filter(u => u !== from && u !== to)
|
|
32304
|
+
.map(u => `convert.${from}->${u}`),
|
|
32305
|
+
];
|
|
32306
|
+
result[fnName] = {
|
|
32307
|
+
evaluate: ([value], sourceCodeInfo) => {
|
|
32308
|
+
assertNumber(value, sourceCodeInfo);
|
|
32309
|
+
const celsius = toCelsius(from, value);
|
|
32310
|
+
return celsiusTo(to, celsius);
|
|
32311
|
+
},
|
|
32312
|
+
arity: toFixedArity(1),
|
|
32313
|
+
docs: {
|
|
32314
|
+
category: 'convert',
|
|
32315
|
+
returns: { type: 'number' },
|
|
32316
|
+
args: {
|
|
32317
|
+
value: { type: 'number', description: `Value in ${fromDesc}` },
|
|
32318
|
+
},
|
|
32319
|
+
variants: [{ argumentNames: ['value'] }],
|
|
32320
|
+
description: `Converts a temperature from ${fromDesc} (\`${from}\`) to ${toDesc} (\`${to}\`).`,
|
|
32321
|
+
seeAlso,
|
|
32322
|
+
examples: [
|
|
32323
|
+
`let { ${fnName} } = import(convert);
|
|
32324
|
+
${fnName}(100)`,
|
|
32325
|
+
],
|
|
32326
|
+
},
|
|
32327
|
+
};
|
|
32328
|
+
}
|
|
32329
|
+
}
|
|
32330
|
+
return result;
|
|
32331
|
+
}
|
|
32332
|
+
// --- Assemble all conversion functions ---
|
|
32333
|
+
const convertFunctions = {
|
|
32334
|
+
...generateLinearConversions(lengthUnits),
|
|
32335
|
+
...generateLinearConversions(weightUnits),
|
|
32336
|
+
...generateLinearConversions(volumeUnits),
|
|
32337
|
+
...generateLinearConversions(timeUnits),
|
|
32338
|
+
...generateLinearConversions(areaUnits),
|
|
32339
|
+
...generateLinearConversions(speedUnits),
|
|
32340
|
+
...generateLinearConversions(dataUnits),
|
|
32341
|
+
...generateLinearConversions(pressureUnits),
|
|
32342
|
+
...generateLinearConversions(energyUnits),
|
|
32343
|
+
...generateLinearConversions(powerUnits),
|
|
32344
|
+
...generateLinearConversions(frequencyUnits),
|
|
32345
|
+
...generateLinearConversions(angleUnits),
|
|
32346
|
+
...generateTemperatureConversions(),
|
|
32347
|
+
};
|
|
32348
|
+
const convertModule = {
|
|
32349
|
+
name: 'convert',
|
|
32350
|
+
functions: convertFunctions,
|
|
32351
|
+
};
|
|
32352
|
+
|
|
32177
32353
|
const allBuiltinModules = [
|
|
32178
32354
|
assertModule,
|
|
32179
32355
|
gridModule,
|
|
@@ -32188,6 +32364,7 @@ const allBuiltinModules = [
|
|
|
32188
32364
|
collectionUtilsModule,
|
|
32189
32365
|
sequenceUtilsModule,
|
|
32190
32366
|
bitwiseUtilsModule,
|
|
32367
|
+
convertModule,
|
|
32191
32368
|
];
|
|
32192
32369
|
|
|
32193
32370
|
function runTest({ testPath: filePath, testNamePattern }) {
|
|
@@ -32568,7 +32745,7 @@ Shorthand for \`(args, ...) -> expression\`.
|
|
|
32568
32745
|
|
|
32569
32746
|
You can reference the first argument using either \`$1\` or \`$\`.
|
|
32570
32747
|
However, please note that \`$1\` and \`$\` are mutually exclusive and cannot be used simultaneously.
|
|
32571
|
-
E.g.
|
|
32748
|
+
E.g. \`-> $ * $1\` is not valid.`,
|
|
32572
32749
|
examples: [
|
|
32573
32750
|
'-> $1 + $2',
|
|
32574
32751
|
'(-> $ * $)(9)',
|
|
@@ -32709,6 +32886,7 @@ const moduleReference = {
|
|
|
32709
32886
|
...moduledDocsToReference(mathUtilsModule.name, mathUtilsModule.functions),
|
|
32710
32887
|
...moduledDocsToReference(functionalUtilsModule.name, functionalUtilsModule.functions),
|
|
32711
32888
|
...moduledDocsToReference(bitwiseUtilsModule.name, bitwiseUtilsModule.functions),
|
|
32889
|
+
...moduledDocsToReference(convertModule.name, convertModule.functions),
|
|
32712
32890
|
};
|
|
32713
32891
|
Object.entries(normalExpressionReference).forEach(([key, obj]) => {
|
|
32714
32892
|
if (!normalExpressions[key]) {
|
|
@@ -33193,6 +33371,9 @@ function getVectorReductionNames(name) {
|
|
|
33193
33371
|
const baseName = name.replace(/^/, '');
|
|
33194
33372
|
return [`vector.${name}`, `vector.moving-${baseName}`, `vector.centered-moving-${baseName}`, `vector.running-${baseName}`];
|
|
33195
33373
|
}
|
|
33374
|
+
function getVectorMovingNames(name) {
|
|
33375
|
+
return [`vector.moving-${name}`, `vector.centered-moving-${name}`, `vector.running-${name}`];
|
|
33376
|
+
}
|
|
33196
33377
|
const api = {
|
|
33197
33378
|
collection: [
|
|
33198
33379
|
'filter',
|
|
@@ -33254,7 +33435,6 @@ const api = {
|
|
|
33254
33435
|
sequenceUtils: [
|
|
33255
33436
|
'sequence.position',
|
|
33256
33437
|
'sequence.last-index-of',
|
|
33257
|
-
'sequence.shift',
|
|
33258
33438
|
'sequence.unshift',
|
|
33259
33439
|
'sequence.splice',
|
|
33260
33440
|
'sequence.sort-by',
|
|
@@ -33467,7 +33647,7 @@ const api = {
|
|
|
33467
33647
|
'assert.assert-vector',
|
|
33468
33648
|
],
|
|
33469
33649
|
grid: [
|
|
33470
|
-
'grid.every?',
|
|
33650
|
+
'grid.cell-every?',
|
|
33471
33651
|
'grid.some?',
|
|
33472
33652
|
'grid.every-row?',
|
|
33473
33653
|
'grid.some-row?',
|
|
@@ -33483,19 +33663,17 @@ const api = {
|
|
|
33483
33663
|
'grid.flip-h',
|
|
33484
33664
|
'grid.flip-v',
|
|
33485
33665
|
'grid.rotate',
|
|
33486
|
-
'grid.
|
|
33487
|
-
'grid.reverse-cols',
|
|
33488
|
-
'grid.slice',
|
|
33666
|
+
'grid.crop',
|
|
33489
33667
|
'grid.slice-rows',
|
|
33490
33668
|
'grid.slice-cols',
|
|
33491
33669
|
'grid.splice-rows',
|
|
33492
33670
|
'grid.splice-cols',
|
|
33493
33671
|
'grid.concat-rows',
|
|
33494
33672
|
'grid.concat-cols',
|
|
33495
|
-
'grid.map',
|
|
33496
|
-
'grid.mapi',
|
|
33497
|
-
'grid.reduce',
|
|
33498
|
-
'grid.reducei',
|
|
33673
|
+
'grid.cell-map',
|
|
33674
|
+
'grid.cell-mapi',
|
|
33675
|
+
'grid.cell-reduce',
|
|
33676
|
+
'grid.cell-reducei',
|
|
33499
33677
|
'grid.push-rows',
|
|
33500
33678
|
'grid.unshift-rows',
|
|
33501
33679
|
'grid.pop-row',
|
|
@@ -33520,7 +33698,7 @@ const api = {
|
|
|
33520
33698
|
'matrix.lower-triangular?',
|
|
33521
33699
|
'matrix.diagonal?',
|
|
33522
33700
|
'matrix.square?',
|
|
33523
|
-
'matrix.orthogonal?',
|
|
33701
|
+
'matrix.orthogonal-matrix?',
|
|
33524
33702
|
'matrix.identity?',
|
|
33525
33703
|
'matrix.invertible?',
|
|
33526
33704
|
'matrix.hilbert',
|
|
@@ -33546,17 +33724,12 @@ const api = {
|
|
|
33546
33724
|
'vector.decreasing?',
|
|
33547
33725
|
'vector.strictly-increasing?',
|
|
33548
33726
|
'vector.strictly-decreasing?',
|
|
33549
|
-
'vector.median',
|
|
33550
33727
|
'vector.mode',
|
|
33551
33728
|
'vector.min-index',
|
|
33552
33729
|
'vector.max-index',
|
|
33553
33730
|
'vector.sort-indices',
|
|
33554
33731
|
'vector.count-values',
|
|
33555
33732
|
'vector.linspace',
|
|
33556
|
-
'vector.ones',
|
|
33557
|
-
'vector.zeros',
|
|
33558
|
-
'vector.fill',
|
|
33559
|
-
'vector.generate',
|
|
33560
33733
|
'vector.cumsum',
|
|
33561
33734
|
'vector.cumprod',
|
|
33562
33735
|
'vector.quartiles',
|
|
@@ -33572,12 +33745,12 @@ const api = {
|
|
|
33572
33745
|
'vector.mae',
|
|
33573
33746
|
'vector.rmse',
|
|
33574
33747
|
'vector.smape',
|
|
33575
|
-
...
|
|
33576
|
-
...
|
|
33748
|
+
...getVectorMovingNames('mean'),
|
|
33749
|
+
...getVectorMovingNames('median'),
|
|
33577
33750
|
...getVectorReductionNames('variance'),
|
|
33578
33751
|
...getVectorReductionNames('sample-variance'),
|
|
33579
|
-
...
|
|
33580
|
-
...
|
|
33752
|
+
...getVectorMovingNames('sum'),
|
|
33753
|
+
...getVectorMovingNames('prod'),
|
|
33581
33754
|
...getVectorReductionNames('stdev'),
|
|
33582
33755
|
...getVectorReductionNames('sample-stdev'),
|
|
33583
33756
|
...getVectorReductionNames('iqr'),
|
|
@@ -33734,6 +33907,536 @@ const api = {
|
|
|
33734
33907
|
'random.random-id!',
|
|
33735
33908
|
'random.random-color!',
|
|
33736
33909
|
],
|
|
33910
|
+
convert: [
|
|
33911
|
+
'convert.angstrom->um',
|
|
33912
|
+
'convert.angstrom->mm',
|
|
33913
|
+
'convert.angstrom->cm',
|
|
33914
|
+
'convert.angstrom->m',
|
|
33915
|
+
'convert.angstrom->km',
|
|
33916
|
+
'convert.angstrom->in',
|
|
33917
|
+
'convert.angstrom->ft',
|
|
33918
|
+
'convert.angstrom->yd',
|
|
33919
|
+
'convert.angstrom->mi',
|
|
33920
|
+
'convert.angstrom->nmi',
|
|
33921
|
+
'convert.um->angstrom',
|
|
33922
|
+
'convert.um->mm',
|
|
33923
|
+
'convert.um->cm',
|
|
33924
|
+
'convert.um->m',
|
|
33925
|
+
'convert.um->km',
|
|
33926
|
+
'convert.um->in',
|
|
33927
|
+
'convert.um->ft',
|
|
33928
|
+
'convert.um->yd',
|
|
33929
|
+
'convert.um->mi',
|
|
33930
|
+
'convert.um->nmi',
|
|
33931
|
+
'convert.mm->angstrom',
|
|
33932
|
+
'convert.mm->um',
|
|
33933
|
+
'convert.mm->cm',
|
|
33934
|
+
'convert.mm->m',
|
|
33935
|
+
'convert.mm->km',
|
|
33936
|
+
'convert.mm->in',
|
|
33937
|
+
'convert.mm->ft',
|
|
33938
|
+
'convert.mm->yd',
|
|
33939
|
+
'convert.mm->mi',
|
|
33940
|
+
'convert.mm->nmi',
|
|
33941
|
+
'convert.cm->angstrom',
|
|
33942
|
+
'convert.cm->um',
|
|
33943
|
+
'convert.cm->mm',
|
|
33944
|
+
'convert.cm->m',
|
|
33945
|
+
'convert.cm->km',
|
|
33946
|
+
'convert.cm->in',
|
|
33947
|
+
'convert.cm->ft',
|
|
33948
|
+
'convert.cm->yd',
|
|
33949
|
+
'convert.cm->mi',
|
|
33950
|
+
'convert.cm->nmi',
|
|
33951
|
+
'convert.m->angstrom',
|
|
33952
|
+
'convert.m->um',
|
|
33953
|
+
'convert.m->mm',
|
|
33954
|
+
'convert.m->cm',
|
|
33955
|
+
'convert.m->km',
|
|
33956
|
+
'convert.m->in',
|
|
33957
|
+
'convert.m->ft',
|
|
33958
|
+
'convert.m->yd',
|
|
33959
|
+
'convert.m->mi',
|
|
33960
|
+
'convert.m->nmi',
|
|
33961
|
+
'convert.km->angstrom',
|
|
33962
|
+
'convert.km->um',
|
|
33963
|
+
'convert.km->mm',
|
|
33964
|
+
'convert.km->cm',
|
|
33965
|
+
'convert.km->m',
|
|
33966
|
+
'convert.km->in',
|
|
33967
|
+
'convert.km->ft',
|
|
33968
|
+
'convert.km->yd',
|
|
33969
|
+
'convert.km->mi',
|
|
33970
|
+
'convert.km->nmi',
|
|
33971
|
+
'convert.in->angstrom',
|
|
33972
|
+
'convert.in->um',
|
|
33973
|
+
'convert.in->mm',
|
|
33974
|
+
'convert.in->cm',
|
|
33975
|
+
'convert.in->m',
|
|
33976
|
+
'convert.in->km',
|
|
33977
|
+
'convert.in->ft',
|
|
33978
|
+
'convert.in->yd',
|
|
33979
|
+
'convert.in->mi',
|
|
33980
|
+
'convert.in->nmi',
|
|
33981
|
+
'convert.ft->angstrom',
|
|
33982
|
+
'convert.ft->um',
|
|
33983
|
+
'convert.ft->mm',
|
|
33984
|
+
'convert.ft->cm',
|
|
33985
|
+
'convert.ft->m',
|
|
33986
|
+
'convert.ft->km',
|
|
33987
|
+
'convert.ft->in',
|
|
33988
|
+
'convert.ft->yd',
|
|
33989
|
+
'convert.ft->mi',
|
|
33990
|
+
'convert.ft->nmi',
|
|
33991
|
+
'convert.yd->angstrom',
|
|
33992
|
+
'convert.yd->um',
|
|
33993
|
+
'convert.yd->mm',
|
|
33994
|
+
'convert.yd->cm',
|
|
33995
|
+
'convert.yd->m',
|
|
33996
|
+
'convert.yd->km',
|
|
33997
|
+
'convert.yd->in',
|
|
33998
|
+
'convert.yd->ft',
|
|
33999
|
+
'convert.yd->mi',
|
|
34000
|
+
'convert.yd->nmi',
|
|
34001
|
+
'convert.mi->angstrom',
|
|
34002
|
+
'convert.mi->um',
|
|
34003
|
+
'convert.mi->mm',
|
|
34004
|
+
'convert.mi->cm',
|
|
34005
|
+
'convert.mi->m',
|
|
34006
|
+
'convert.mi->km',
|
|
34007
|
+
'convert.mi->in',
|
|
34008
|
+
'convert.mi->ft',
|
|
34009
|
+
'convert.mi->yd',
|
|
34010
|
+
'convert.mi->nmi',
|
|
34011
|
+
'convert.nmi->angstrom',
|
|
34012
|
+
'convert.nmi->um',
|
|
34013
|
+
'convert.nmi->mm',
|
|
34014
|
+
'convert.nmi->cm',
|
|
34015
|
+
'convert.nmi->m',
|
|
34016
|
+
'convert.nmi->km',
|
|
34017
|
+
'convert.nmi->in',
|
|
34018
|
+
'convert.nmi->ft',
|
|
34019
|
+
'convert.nmi->yd',
|
|
34020
|
+
'convert.nmi->mi',
|
|
34021
|
+
'convert.mg->g',
|
|
34022
|
+
'convert.mg->kg',
|
|
34023
|
+
'convert.mg->t',
|
|
34024
|
+
'convert.mg->oz',
|
|
34025
|
+
'convert.mg->lb',
|
|
34026
|
+
'convert.mg->st',
|
|
34027
|
+
'convert.g->mg',
|
|
34028
|
+
'convert.g->kg',
|
|
34029
|
+
'convert.g->t',
|
|
34030
|
+
'convert.g->oz',
|
|
34031
|
+
'convert.g->lb',
|
|
34032
|
+
'convert.g->st',
|
|
34033
|
+
'convert.kg->mg',
|
|
34034
|
+
'convert.kg->g',
|
|
34035
|
+
'convert.kg->t',
|
|
34036
|
+
'convert.kg->oz',
|
|
34037
|
+
'convert.kg->lb',
|
|
34038
|
+
'convert.kg->st',
|
|
34039
|
+
'convert.t->mg',
|
|
34040
|
+
'convert.t->g',
|
|
34041
|
+
'convert.t->kg',
|
|
34042
|
+
'convert.t->oz',
|
|
34043
|
+
'convert.t->lb',
|
|
34044
|
+
'convert.t->st',
|
|
34045
|
+
'convert.oz->mg',
|
|
34046
|
+
'convert.oz->g',
|
|
34047
|
+
'convert.oz->kg',
|
|
34048
|
+
'convert.oz->t',
|
|
34049
|
+
'convert.oz->lb',
|
|
34050
|
+
'convert.oz->st',
|
|
34051
|
+
'convert.lb->mg',
|
|
34052
|
+
'convert.lb->g',
|
|
34053
|
+
'convert.lb->kg',
|
|
34054
|
+
'convert.lb->t',
|
|
34055
|
+
'convert.lb->oz',
|
|
34056
|
+
'convert.lb->st',
|
|
34057
|
+
'convert.st->mg',
|
|
34058
|
+
'convert.st->g',
|
|
34059
|
+
'convert.st->kg',
|
|
34060
|
+
'convert.st->t',
|
|
34061
|
+
'convert.st->oz',
|
|
34062
|
+
'convert.st->lb',
|
|
34063
|
+
'convert.ml->cl',
|
|
34064
|
+
'convert.ml->dl',
|
|
34065
|
+
'convert.ml->l',
|
|
34066
|
+
'convert.ml->tsp',
|
|
34067
|
+
'convert.ml->tbsp',
|
|
34068
|
+
'convert.ml->fl-oz',
|
|
34069
|
+
'convert.ml->cup',
|
|
34070
|
+
'convert.ml->pt',
|
|
34071
|
+
'convert.ml->qt',
|
|
34072
|
+
'convert.ml->gal',
|
|
34073
|
+
'convert.cl->ml',
|
|
34074
|
+
'convert.cl->dl',
|
|
34075
|
+
'convert.cl->l',
|
|
34076
|
+
'convert.cl->tsp',
|
|
34077
|
+
'convert.cl->tbsp',
|
|
34078
|
+
'convert.cl->fl-oz',
|
|
34079
|
+
'convert.cl->cup',
|
|
34080
|
+
'convert.cl->pt',
|
|
34081
|
+
'convert.cl->qt',
|
|
34082
|
+
'convert.cl->gal',
|
|
34083
|
+
'convert.dl->ml',
|
|
34084
|
+
'convert.dl->cl',
|
|
34085
|
+
'convert.dl->l',
|
|
34086
|
+
'convert.dl->tsp',
|
|
34087
|
+
'convert.dl->tbsp',
|
|
34088
|
+
'convert.dl->fl-oz',
|
|
34089
|
+
'convert.dl->cup',
|
|
34090
|
+
'convert.dl->pt',
|
|
34091
|
+
'convert.dl->qt',
|
|
34092
|
+
'convert.dl->gal',
|
|
34093
|
+
'convert.l->ml',
|
|
34094
|
+
'convert.l->cl',
|
|
34095
|
+
'convert.l->dl',
|
|
34096
|
+
'convert.l->tsp',
|
|
34097
|
+
'convert.l->tbsp',
|
|
34098
|
+
'convert.l->fl-oz',
|
|
34099
|
+
'convert.l->cup',
|
|
34100
|
+
'convert.l->pt',
|
|
34101
|
+
'convert.l->qt',
|
|
34102
|
+
'convert.l->gal',
|
|
34103
|
+
'convert.tsp->ml',
|
|
34104
|
+
'convert.tsp->cl',
|
|
34105
|
+
'convert.tsp->dl',
|
|
34106
|
+
'convert.tsp->l',
|
|
34107
|
+
'convert.tsp->tbsp',
|
|
34108
|
+
'convert.tsp->fl-oz',
|
|
34109
|
+
'convert.tsp->cup',
|
|
34110
|
+
'convert.tsp->pt',
|
|
34111
|
+
'convert.tsp->qt',
|
|
34112
|
+
'convert.tsp->gal',
|
|
34113
|
+
'convert.tbsp->ml',
|
|
34114
|
+
'convert.tbsp->cl',
|
|
34115
|
+
'convert.tbsp->dl',
|
|
34116
|
+
'convert.tbsp->l',
|
|
34117
|
+
'convert.tbsp->tsp',
|
|
34118
|
+
'convert.tbsp->fl-oz',
|
|
34119
|
+
'convert.tbsp->cup',
|
|
34120
|
+
'convert.tbsp->pt',
|
|
34121
|
+
'convert.tbsp->qt',
|
|
34122
|
+
'convert.tbsp->gal',
|
|
34123
|
+
'convert.fl-oz->ml',
|
|
34124
|
+
'convert.fl-oz->cl',
|
|
34125
|
+
'convert.fl-oz->dl',
|
|
34126
|
+
'convert.fl-oz->l',
|
|
34127
|
+
'convert.fl-oz->tsp',
|
|
34128
|
+
'convert.fl-oz->tbsp',
|
|
34129
|
+
'convert.fl-oz->cup',
|
|
34130
|
+
'convert.fl-oz->pt',
|
|
34131
|
+
'convert.fl-oz->qt',
|
|
34132
|
+
'convert.fl-oz->gal',
|
|
34133
|
+
'convert.cup->ml',
|
|
34134
|
+
'convert.cup->cl',
|
|
34135
|
+
'convert.cup->dl',
|
|
34136
|
+
'convert.cup->l',
|
|
34137
|
+
'convert.cup->tsp',
|
|
34138
|
+
'convert.cup->tbsp',
|
|
34139
|
+
'convert.cup->fl-oz',
|
|
34140
|
+
'convert.cup->pt',
|
|
34141
|
+
'convert.cup->qt',
|
|
34142
|
+
'convert.cup->gal',
|
|
34143
|
+
'convert.pt->ml',
|
|
34144
|
+
'convert.pt->cl',
|
|
34145
|
+
'convert.pt->dl',
|
|
34146
|
+
'convert.pt->l',
|
|
34147
|
+
'convert.pt->tsp',
|
|
34148
|
+
'convert.pt->tbsp',
|
|
34149
|
+
'convert.pt->fl-oz',
|
|
34150
|
+
'convert.pt->cup',
|
|
34151
|
+
'convert.pt->qt',
|
|
34152
|
+
'convert.pt->gal',
|
|
34153
|
+
'convert.qt->ml',
|
|
34154
|
+
'convert.qt->cl',
|
|
34155
|
+
'convert.qt->dl',
|
|
34156
|
+
'convert.qt->l',
|
|
34157
|
+
'convert.qt->tsp',
|
|
34158
|
+
'convert.qt->tbsp',
|
|
34159
|
+
'convert.qt->fl-oz',
|
|
34160
|
+
'convert.qt->cup',
|
|
34161
|
+
'convert.qt->pt',
|
|
34162
|
+
'convert.qt->gal',
|
|
34163
|
+
'convert.gal->ml',
|
|
34164
|
+
'convert.gal->cl',
|
|
34165
|
+
'convert.gal->dl',
|
|
34166
|
+
'convert.gal->l',
|
|
34167
|
+
'convert.gal->tsp',
|
|
34168
|
+
'convert.gal->tbsp',
|
|
34169
|
+
'convert.gal->fl-oz',
|
|
34170
|
+
'convert.gal->cup',
|
|
34171
|
+
'convert.gal->pt',
|
|
34172
|
+
'convert.gal->qt',
|
|
34173
|
+
'convert.ms->s',
|
|
34174
|
+
'convert.ms->min',
|
|
34175
|
+
'convert.ms->h',
|
|
34176
|
+
'convert.ms->day',
|
|
34177
|
+
'convert.ms->week',
|
|
34178
|
+
'convert.s->ms',
|
|
34179
|
+
'convert.s->min',
|
|
34180
|
+
'convert.s->h',
|
|
34181
|
+
'convert.s->day',
|
|
34182
|
+
'convert.s->week',
|
|
34183
|
+
'convert.min->ms',
|
|
34184
|
+
'convert.min->s',
|
|
34185
|
+
'convert.min->h',
|
|
34186
|
+
'convert.min->day',
|
|
34187
|
+
'convert.min->week',
|
|
34188
|
+
'convert.h->ms',
|
|
34189
|
+
'convert.h->s',
|
|
34190
|
+
'convert.h->min',
|
|
34191
|
+
'convert.h->day',
|
|
34192
|
+
'convert.h->week',
|
|
34193
|
+
'convert.day->ms',
|
|
34194
|
+
'convert.day->s',
|
|
34195
|
+
'convert.day->min',
|
|
34196
|
+
'convert.day->h',
|
|
34197
|
+
'convert.day->week',
|
|
34198
|
+
'convert.week->ms',
|
|
34199
|
+
'convert.week->s',
|
|
34200
|
+
'convert.week->min',
|
|
34201
|
+
'convert.week->h',
|
|
34202
|
+
'convert.week->day',
|
|
34203
|
+
'convert.mm2->cm2',
|
|
34204
|
+
'convert.mm2->m2',
|
|
34205
|
+
'convert.mm2->km2',
|
|
34206
|
+
'convert.mm2->in2',
|
|
34207
|
+
'convert.mm2->ft2',
|
|
34208
|
+
'convert.mm2->yd2',
|
|
34209
|
+
'convert.mm2->acre',
|
|
34210
|
+
'convert.mm2->hectare',
|
|
34211
|
+
'convert.cm2->mm2',
|
|
34212
|
+
'convert.cm2->m2',
|
|
34213
|
+
'convert.cm2->km2',
|
|
34214
|
+
'convert.cm2->in2',
|
|
34215
|
+
'convert.cm2->ft2',
|
|
34216
|
+
'convert.cm2->yd2',
|
|
34217
|
+
'convert.cm2->acre',
|
|
34218
|
+
'convert.cm2->hectare',
|
|
34219
|
+
'convert.m2->mm2',
|
|
34220
|
+
'convert.m2->cm2',
|
|
34221
|
+
'convert.m2->km2',
|
|
34222
|
+
'convert.m2->in2',
|
|
34223
|
+
'convert.m2->ft2',
|
|
34224
|
+
'convert.m2->yd2',
|
|
34225
|
+
'convert.m2->acre',
|
|
34226
|
+
'convert.m2->hectare',
|
|
34227
|
+
'convert.km2->mm2',
|
|
34228
|
+
'convert.km2->cm2',
|
|
34229
|
+
'convert.km2->m2',
|
|
34230
|
+
'convert.km2->in2',
|
|
34231
|
+
'convert.km2->ft2',
|
|
34232
|
+
'convert.km2->yd2',
|
|
34233
|
+
'convert.km2->acre',
|
|
34234
|
+
'convert.km2->hectare',
|
|
34235
|
+
'convert.in2->mm2',
|
|
34236
|
+
'convert.in2->cm2',
|
|
34237
|
+
'convert.in2->m2',
|
|
34238
|
+
'convert.in2->km2',
|
|
34239
|
+
'convert.in2->ft2',
|
|
34240
|
+
'convert.in2->yd2',
|
|
34241
|
+
'convert.in2->acre',
|
|
34242
|
+
'convert.in2->hectare',
|
|
34243
|
+
'convert.ft2->mm2',
|
|
34244
|
+
'convert.ft2->cm2',
|
|
34245
|
+
'convert.ft2->m2',
|
|
34246
|
+
'convert.ft2->km2',
|
|
34247
|
+
'convert.ft2->in2',
|
|
34248
|
+
'convert.ft2->yd2',
|
|
34249
|
+
'convert.ft2->acre',
|
|
34250
|
+
'convert.ft2->hectare',
|
|
34251
|
+
'convert.yd2->mm2',
|
|
34252
|
+
'convert.yd2->cm2',
|
|
34253
|
+
'convert.yd2->m2',
|
|
34254
|
+
'convert.yd2->km2',
|
|
34255
|
+
'convert.yd2->in2',
|
|
34256
|
+
'convert.yd2->ft2',
|
|
34257
|
+
'convert.yd2->acre',
|
|
34258
|
+
'convert.yd2->hectare',
|
|
34259
|
+
'convert.acre->mm2',
|
|
34260
|
+
'convert.acre->cm2',
|
|
34261
|
+
'convert.acre->m2',
|
|
34262
|
+
'convert.acre->km2',
|
|
34263
|
+
'convert.acre->in2',
|
|
34264
|
+
'convert.acre->ft2',
|
|
34265
|
+
'convert.acre->yd2',
|
|
34266
|
+
'convert.acre->hectare',
|
|
34267
|
+
'convert.hectare->mm2',
|
|
34268
|
+
'convert.hectare->cm2',
|
|
34269
|
+
'convert.hectare->m2',
|
|
34270
|
+
'convert.hectare->km2',
|
|
34271
|
+
'convert.hectare->in2',
|
|
34272
|
+
'convert.hectare->ft2',
|
|
34273
|
+
'convert.hectare->yd2',
|
|
34274
|
+
'convert.hectare->acre',
|
|
34275
|
+
'convert.m/s->km/h',
|
|
34276
|
+
'convert.m/s->mph',
|
|
34277
|
+
'convert.m/s->kn',
|
|
34278
|
+
'convert.m/s->ft/s',
|
|
34279
|
+
'convert.km/h->m/s',
|
|
34280
|
+
'convert.km/h->mph',
|
|
34281
|
+
'convert.km/h->kn',
|
|
34282
|
+
'convert.km/h->ft/s',
|
|
34283
|
+
'convert.mph->m/s',
|
|
34284
|
+
'convert.mph->km/h',
|
|
34285
|
+
'convert.mph->kn',
|
|
34286
|
+
'convert.mph->ft/s',
|
|
34287
|
+
'convert.kn->m/s',
|
|
34288
|
+
'convert.kn->km/h',
|
|
34289
|
+
'convert.kn->mph',
|
|
34290
|
+
'convert.kn->ft/s',
|
|
34291
|
+
'convert.ft/s->m/s',
|
|
34292
|
+
'convert.ft/s->km/h',
|
|
34293
|
+
'convert.ft/s->mph',
|
|
34294
|
+
'convert.ft/s->kn',
|
|
34295
|
+
'convert.b->kb',
|
|
34296
|
+
'convert.b->mb',
|
|
34297
|
+
'convert.b->gb',
|
|
34298
|
+
'convert.b->tb',
|
|
34299
|
+
'convert.b->pb',
|
|
34300
|
+
'convert.kb->b',
|
|
34301
|
+
'convert.kb->mb',
|
|
34302
|
+
'convert.kb->gb',
|
|
34303
|
+
'convert.kb->tb',
|
|
34304
|
+
'convert.kb->pb',
|
|
34305
|
+
'convert.mb->b',
|
|
34306
|
+
'convert.mb->kb',
|
|
34307
|
+
'convert.mb->gb',
|
|
34308
|
+
'convert.mb->tb',
|
|
34309
|
+
'convert.mb->pb',
|
|
34310
|
+
'convert.gb->b',
|
|
34311
|
+
'convert.gb->kb',
|
|
34312
|
+
'convert.gb->mb',
|
|
34313
|
+
'convert.gb->tb',
|
|
34314
|
+
'convert.gb->pb',
|
|
34315
|
+
'convert.tb->b',
|
|
34316
|
+
'convert.tb->kb',
|
|
34317
|
+
'convert.tb->mb',
|
|
34318
|
+
'convert.tb->gb',
|
|
34319
|
+
'convert.tb->pb',
|
|
34320
|
+
'convert.pb->b',
|
|
34321
|
+
'convert.pb->kb',
|
|
34322
|
+
'convert.pb->mb',
|
|
34323
|
+
'convert.pb->gb',
|
|
34324
|
+
'convert.pb->tb',
|
|
34325
|
+
'convert.pa->kpa',
|
|
34326
|
+
'convert.pa->bar',
|
|
34327
|
+
'convert.pa->atm',
|
|
34328
|
+
'convert.pa->psi',
|
|
34329
|
+
'convert.pa->mmhg',
|
|
34330
|
+
'convert.kpa->pa',
|
|
34331
|
+
'convert.kpa->bar',
|
|
34332
|
+
'convert.kpa->atm',
|
|
34333
|
+
'convert.kpa->psi',
|
|
34334
|
+
'convert.kpa->mmhg',
|
|
34335
|
+
'convert.bar->pa',
|
|
34336
|
+
'convert.bar->kpa',
|
|
34337
|
+
'convert.bar->atm',
|
|
34338
|
+
'convert.bar->psi',
|
|
34339
|
+
'convert.bar->mmhg',
|
|
34340
|
+
'convert.atm->pa',
|
|
34341
|
+
'convert.atm->kpa',
|
|
34342
|
+
'convert.atm->bar',
|
|
34343
|
+
'convert.atm->psi',
|
|
34344
|
+
'convert.atm->mmhg',
|
|
34345
|
+
'convert.psi->pa',
|
|
34346
|
+
'convert.psi->kpa',
|
|
34347
|
+
'convert.psi->bar',
|
|
34348
|
+
'convert.psi->atm',
|
|
34349
|
+
'convert.psi->mmhg',
|
|
34350
|
+
'convert.mmhg->pa',
|
|
34351
|
+
'convert.mmhg->kpa',
|
|
34352
|
+
'convert.mmhg->bar',
|
|
34353
|
+
'convert.mmhg->atm',
|
|
34354
|
+
'convert.mmhg->psi',
|
|
34355
|
+
'convert.j->kj',
|
|
34356
|
+
'convert.j->cal',
|
|
34357
|
+
'convert.j->kcal',
|
|
34358
|
+
'convert.j->wh',
|
|
34359
|
+
'convert.j->kwh',
|
|
34360
|
+
'convert.j->btu',
|
|
34361
|
+
'convert.kj->j',
|
|
34362
|
+
'convert.kj->cal',
|
|
34363
|
+
'convert.kj->kcal',
|
|
34364
|
+
'convert.kj->wh',
|
|
34365
|
+
'convert.kj->kwh',
|
|
34366
|
+
'convert.kj->btu',
|
|
34367
|
+
'convert.cal->j',
|
|
34368
|
+
'convert.cal->kj',
|
|
34369
|
+
'convert.cal->kcal',
|
|
34370
|
+
'convert.cal->wh',
|
|
34371
|
+
'convert.cal->kwh',
|
|
34372
|
+
'convert.cal->btu',
|
|
34373
|
+
'convert.kcal->j',
|
|
34374
|
+
'convert.kcal->kj',
|
|
34375
|
+
'convert.kcal->cal',
|
|
34376
|
+
'convert.kcal->wh',
|
|
34377
|
+
'convert.kcal->kwh',
|
|
34378
|
+
'convert.kcal->btu',
|
|
34379
|
+
'convert.wh->j',
|
|
34380
|
+
'convert.wh->kj',
|
|
34381
|
+
'convert.wh->cal',
|
|
34382
|
+
'convert.wh->kcal',
|
|
34383
|
+
'convert.wh->kwh',
|
|
34384
|
+
'convert.wh->btu',
|
|
34385
|
+
'convert.kwh->j',
|
|
34386
|
+
'convert.kwh->kj',
|
|
34387
|
+
'convert.kwh->cal',
|
|
34388
|
+
'convert.kwh->kcal',
|
|
34389
|
+
'convert.kwh->wh',
|
|
34390
|
+
'convert.kwh->btu',
|
|
34391
|
+
'convert.btu->j',
|
|
34392
|
+
'convert.btu->kj',
|
|
34393
|
+
'convert.btu->cal',
|
|
34394
|
+
'convert.btu->kcal',
|
|
34395
|
+
'convert.btu->wh',
|
|
34396
|
+
'convert.btu->kwh',
|
|
34397
|
+
'convert.w->kw',
|
|
34398
|
+
'convert.w->mw',
|
|
34399
|
+
'convert.w->hp',
|
|
34400
|
+
'convert.kw->w',
|
|
34401
|
+
'convert.kw->mw',
|
|
34402
|
+
'convert.kw->hp',
|
|
34403
|
+
'convert.mw->w',
|
|
34404
|
+
'convert.mw->kw',
|
|
34405
|
+
'convert.mw->hp',
|
|
34406
|
+
'convert.hp->w',
|
|
34407
|
+
'convert.hp->kw',
|
|
34408
|
+
'convert.hp->mw',
|
|
34409
|
+
'convert.hz->khz',
|
|
34410
|
+
'convert.hz->mhz',
|
|
34411
|
+
'convert.hz->ghz',
|
|
34412
|
+
'convert.khz->hz',
|
|
34413
|
+
'convert.khz->mhz',
|
|
34414
|
+
'convert.khz->ghz',
|
|
34415
|
+
'convert.mhz->hz',
|
|
34416
|
+
'convert.mhz->khz',
|
|
34417
|
+
'convert.mhz->ghz',
|
|
34418
|
+
'convert.ghz->hz',
|
|
34419
|
+
'convert.ghz->khz',
|
|
34420
|
+
'convert.ghz->mhz',
|
|
34421
|
+
'convert.deg->rad',
|
|
34422
|
+
'convert.deg->grad',
|
|
34423
|
+
'convert.deg->turn',
|
|
34424
|
+
'convert.rad->deg',
|
|
34425
|
+
'convert.rad->grad',
|
|
34426
|
+
'convert.rad->turn',
|
|
34427
|
+
'convert.grad->deg',
|
|
34428
|
+
'convert.grad->rad',
|
|
34429
|
+
'convert.grad->turn',
|
|
34430
|
+
'convert.turn->deg',
|
|
34431
|
+
'convert.turn->rad',
|
|
34432
|
+
'convert.turn->grad',
|
|
34433
|
+
'convert.c->f',
|
|
34434
|
+
'convert.c->k',
|
|
34435
|
+
'convert.f->c',
|
|
34436
|
+
'convert.f->k',
|
|
34437
|
+
'convert.k->c',
|
|
34438
|
+
'convert.k->f',
|
|
34439
|
+
],
|
|
33737
34440
|
shorthand: [
|
|
33738
34441
|
'-short-regexp',
|
|
33739
34442
|
'-short-fn',
|
|
@@ -34668,6 +35371,7 @@ const HIST_SIZE = 1000;
|
|
|
34668
35371
|
const PROMPT = fmt.bright.gray('> ');
|
|
34669
35372
|
const historyResults = [];
|
|
34670
35373
|
const formatValue = getInlineCodeFormatter(fmt);
|
|
35374
|
+
const booleanFlags = new Set(['-s', '--silent', '--pure']);
|
|
34671
35375
|
const commands = ['`help', '`quit', '`builtins', '`context'];
|
|
34672
35376
|
const expressionRegExp = new RegExp(`^(.*\\(\\s*)(${polishSymbolFirstCharacterClass}${polishSymbolCharacterClass}*)$`);
|
|
34673
35377
|
const nameRegExp = new RegExp(`^(.*?)(${polishSymbolFirstCharacterClass}${polishSymbolCharacterClass}*)$`);
|
|
@@ -34846,14 +35550,26 @@ function setReplHistoryVariables(context) {
|
|
|
34846
35550
|
}
|
|
34847
35551
|
function parseOption(args, i) {
|
|
34848
35552
|
const option = args[i];
|
|
34849
|
-
|
|
34850
|
-
|
|
34851
|
-
|
|
34852
|
-
|
|
35553
|
+
// Short option: -x
|
|
35554
|
+
if (/^-[a-z]$/i.test(option)) {
|
|
35555
|
+
if (booleanFlags.has(option)) {
|
|
35556
|
+
return { option, argument: null, count: 1 };
|
|
35557
|
+
}
|
|
34853
35558
|
return { option, argument: args[i + 1] ?? null, count: 2 };
|
|
35559
|
+
}
|
|
35560
|
+
// Long option: --foo or --foo=value
|
|
34854
35561
|
const match = /^(--[a-z-]+)(?:=(.*))?$/i.exec(option);
|
|
34855
|
-
if (match)
|
|
34856
|
-
|
|
35562
|
+
if (match) {
|
|
35563
|
+
const name = match[1];
|
|
35564
|
+
const inlineArg = match[2];
|
|
35565
|
+
if (inlineArg !== undefined) {
|
|
35566
|
+
return { option: name, argument: inlineArg, count: 1 };
|
|
35567
|
+
}
|
|
35568
|
+
if (booleanFlags.has(name)) {
|
|
35569
|
+
return { option: name, argument: null, count: 1 };
|
|
35570
|
+
}
|
|
35571
|
+
return { option: name, argument: args[i + 1] ?? null, count: 2 };
|
|
35572
|
+
}
|
|
34857
35573
|
return null;
|
|
34858
35574
|
}
|
|
34859
35575
|
function parseContextOptions(args, startIndex) {
|
|
@@ -34928,11 +35644,19 @@ function parseRunEvalOptions(args, startIndex) {
|
|
|
34928
35644
|
let context = {};
|
|
34929
35645
|
let printResult = true;
|
|
34930
35646
|
let pure = false;
|
|
35647
|
+
let positional = null;
|
|
34931
35648
|
let i = startIndex;
|
|
34932
35649
|
while (i < args.length) {
|
|
34933
35650
|
const parsed = parseOption(args, i);
|
|
34934
|
-
if (!parsed)
|
|
34935
|
-
|
|
35651
|
+
if (!parsed) {
|
|
35652
|
+
if (positional !== null) {
|
|
35653
|
+
printErrorMessage(`Unexpected argument "${args[i]}"`);
|
|
35654
|
+
process.exit(1);
|
|
35655
|
+
}
|
|
35656
|
+
positional = args[i];
|
|
35657
|
+
i += 1;
|
|
35658
|
+
continue;
|
|
35659
|
+
}
|
|
34936
35660
|
switch (parsed.option) {
|
|
34937
35661
|
case '-c':
|
|
34938
35662
|
case '--context':
|
|
@@ -34959,11 +35683,7 @@ function parseRunEvalOptions(args, startIndex) {
|
|
|
34959
35683
|
process.exit(1);
|
|
34960
35684
|
}
|
|
34961
35685
|
}
|
|
34962
|
-
|
|
34963
|
-
printErrorMessage(`Unknown argument "${args[i]}"`);
|
|
34964
|
-
process.exit(1);
|
|
34965
|
-
}
|
|
34966
|
-
return { context, printResult, pure, nextIndex: i };
|
|
35686
|
+
return { context, printResult, pure, positional, nextIndex: i };
|
|
34967
35687
|
}
|
|
34968
35688
|
function processArguments(args) {
|
|
34969
35689
|
// Global flags (no subcommand)
|
|
@@ -34979,45 +35699,43 @@ function processArguments(args) {
|
|
|
34979
35699
|
}
|
|
34980
35700
|
switch (first) {
|
|
34981
35701
|
case 'run': {
|
|
34982
|
-
const filename = args
|
|
34983
|
-
if (!filename
|
|
35702
|
+
const { positional: filename, context, printResult, pure } = parseRunEvalOptions(args, 1);
|
|
35703
|
+
if (!filename) {
|
|
34984
35704
|
printErrorMessage('Missing filename after "run"');
|
|
34985
35705
|
process.exit(1);
|
|
34986
35706
|
}
|
|
34987
|
-
const { context, printResult, pure } = parseRunEvalOptions(args, 2);
|
|
34988
35707
|
return { subcommand: 'run', filename, context, printResult, pure };
|
|
34989
35708
|
}
|
|
34990
35709
|
case 'run-bundle': {
|
|
34991
|
-
const filename = args
|
|
34992
|
-
if (!filename
|
|
35710
|
+
const { positional: filename, context, printResult, pure } = parseRunEvalOptions(args, 1);
|
|
35711
|
+
if (!filename) {
|
|
34993
35712
|
printErrorMessage('Missing filename after "run-bundle"');
|
|
34994
35713
|
process.exit(1);
|
|
34995
35714
|
}
|
|
34996
|
-
const { context, printResult, pure } = parseRunEvalOptions(args, 2);
|
|
34997
35715
|
return { subcommand: 'run-bundle', filename, context, printResult, pure };
|
|
34998
35716
|
}
|
|
34999
35717
|
case 'eval': {
|
|
35000
|
-
const expression = args
|
|
35001
|
-
if (!expression
|
|
35718
|
+
const { positional: expression, context, printResult, pure } = parseRunEvalOptions(args, 1);
|
|
35719
|
+
if (!expression) {
|
|
35002
35720
|
printErrorMessage('Missing expression after "eval"');
|
|
35003
35721
|
process.exit(1);
|
|
35004
35722
|
}
|
|
35005
|
-
const { context, printResult, pure } = parseRunEvalOptions(args, 2);
|
|
35006
35723
|
return { subcommand: 'eval', expression, context, printResult, pure };
|
|
35007
35724
|
}
|
|
35008
35725
|
case 'bundle': {
|
|
35009
|
-
|
|
35010
|
-
if (!filename || filename.startsWith('-')) {
|
|
35011
|
-
printErrorMessage('Missing filename after "bundle"');
|
|
35012
|
-
process.exit(1);
|
|
35013
|
-
}
|
|
35726
|
+
let filename = null;
|
|
35014
35727
|
let output = null;
|
|
35015
|
-
let i =
|
|
35728
|
+
let i = 1;
|
|
35016
35729
|
while (i < args.length) {
|
|
35017
35730
|
const parsed = parseOption(args, i);
|
|
35018
35731
|
if (!parsed) {
|
|
35019
|
-
|
|
35020
|
-
|
|
35732
|
+
if (filename !== null) {
|
|
35733
|
+
printErrorMessage(`Unexpected argument "${args[i]}"`);
|
|
35734
|
+
process.exit(1);
|
|
35735
|
+
}
|
|
35736
|
+
filename = args[i];
|
|
35737
|
+
i += 1;
|
|
35738
|
+
continue;
|
|
35021
35739
|
}
|
|
35022
35740
|
switch (parsed.option) {
|
|
35023
35741
|
case '-o':
|
|
@@ -35034,21 +35752,26 @@ function processArguments(args) {
|
|
|
35034
35752
|
process.exit(1);
|
|
35035
35753
|
}
|
|
35036
35754
|
}
|
|
35755
|
+
if (!filename) {
|
|
35756
|
+
printErrorMessage('Missing filename after "bundle"');
|
|
35757
|
+
process.exit(1);
|
|
35758
|
+
}
|
|
35037
35759
|
return { subcommand: 'bundle', filename, output };
|
|
35038
35760
|
}
|
|
35039
35761
|
case 'test': {
|
|
35040
|
-
|
|
35041
|
-
if (!filename || filename.startsWith('-')) {
|
|
35042
|
-
printErrorMessage('Missing filename after "test"');
|
|
35043
|
-
process.exit(1);
|
|
35044
|
-
}
|
|
35762
|
+
let filename = null;
|
|
35045
35763
|
let testPattern = null;
|
|
35046
|
-
let i =
|
|
35764
|
+
let i = 1;
|
|
35047
35765
|
while (i < args.length) {
|
|
35048
35766
|
const parsed = parseOption(args, i);
|
|
35049
35767
|
if (!parsed) {
|
|
35050
|
-
|
|
35051
|
-
|
|
35768
|
+
if (filename !== null) {
|
|
35769
|
+
printErrorMessage(`Unexpected argument "${args[i]}"`);
|
|
35770
|
+
process.exit(1);
|
|
35771
|
+
}
|
|
35772
|
+
filename = args[i];
|
|
35773
|
+
i += 1;
|
|
35774
|
+
continue;
|
|
35052
35775
|
}
|
|
35053
35776
|
switch (parsed.option) {
|
|
35054
35777
|
case '--pattern':
|
|
@@ -35064,6 +35787,10 @@ function processArguments(args) {
|
|
|
35064
35787
|
process.exit(1);
|
|
35065
35788
|
}
|
|
35066
35789
|
}
|
|
35790
|
+
if (!filename) {
|
|
35791
|
+
printErrorMessage('Missing filename after "test"');
|
|
35792
|
+
process.exit(1);
|
|
35793
|
+
}
|
|
35067
35794
|
return { subcommand: 'test', filename, testPattern };
|
|
35068
35795
|
}
|
|
35069
35796
|
case 'repl': {
|