@mojir/lits 2.1.11 → 2.1.13
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/dist/cli/cli.js +492 -72
- package/dist/cli/reference/api.d.ts +4 -4
- package/dist/cli/reference/index.d.ts +7 -1
- package/dist/cli/src/tokenizer/operators.d.ts +1 -1
- package/dist/index.esm.js +454 -66
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +454 -66
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +454 -66
- package/dist/lits.iife.js.map +1 -1
- package/dist/reference/api.d.ts +4 -4
- package/dist/reference/index.d.ts +7 -1
- package/dist/src/tokenizer/operators.d.ts +1 -1
- package/dist/testFramework.esm.js +243 -34
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +243 -34
- package/dist/testFramework.js.map +1 -1
- package/package.json +2 -2
package/dist/reference/api.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Argument } from '.';
|
|
2
2
|
export declare const api: {
|
|
3
|
-
readonly collection: readonly ["filter", "map", "reduce", "reduce-right", "reductions", "count", "get", "get-in", "contains?", "assoc", "assoc-in", "++", "not-empty", "every?", "not-every?", "any?", "not-any?", "update", "update-in"];
|
|
4
|
-
readonly array: readonly ["range", "repeat", "flatten", "mapcat"];
|
|
3
|
+
readonly collection: readonly ["filter", "filteri", "map", "mapi", "reduce", "reducei", "reduce-right", "reducei-right", "reductions", "reductionsi", "count", "get", "get-in", "contains?", "assoc", "assoc-in", "++", "not-empty", "every?", "not-every?", "any?", "not-any?", "update", "update-in"];
|
|
4
|
+
readonly array: readonly ["range", "repeat", "flatten", "mapcat", "moving-fn", "running-fn"];
|
|
5
5
|
readonly sequence: readonly ["nth", "push", "pop", "unshift", "shift", "slice", "splice", "position", "index-of", "last-index-of", "some", "reverse", "first", "second", "last", "rest", "next", "take", "take-last", "take-while", "drop", "drop-last", "drop-while", "sort", "sort-by", "distinct", "remove", "remove-at", "split-at", "split-with", "frequencies", "group-by", "partition", "partition-all", "partition-by", "starts-with?", "ends-with?", "interleave", "interpose"];
|
|
6
6
|
readonly math: readonly ["+", "-", "*", "/", "mod", "rem", "quot", "inc", "dec", "sqrt", "cbrt", "^", "round", "trunc", "floor", "ceil", "min", "max", "abs", "sign", "ln", "log2", "log10", "sin", "cos", "tan", "asin", "acos", "atan", "sinh", "cosh", "tanh", "asinh", "acosh", "atanh", "to-rad", "to-deg"];
|
|
7
7
|
readonly functional: readonly ["|>", "apply", "identity", "comp", "constantly", "juxt", "complement", "every-pred", "some-pred", "fnull"];
|
|
8
8
|
readonly misc: readonly ["≠", "=", "<", ">", "≤", "≥", "!", "write!", "iso-date->epoch", "epoch->iso-date", "boolean", "compare", "identical?", "json-parse", "json-stringify"];
|
|
9
9
|
readonly object: readonly ["dissoc", "keys", "vals", "entries", "find", "merge", "merge-with", "zipmap", "select-keys"];
|
|
10
|
-
readonly predicate: readonly ["boolean?", "null?", "number?", "string?", "function?", "integer?", "array?", "object?", "coll?", "seq?", "regexp?", "zero?", "pos?", "neg?", "even?", "odd?", "finite?", "
|
|
10
|
+
readonly predicate: readonly ["boolean?", "null?", "number?", "string?", "function?", "integer?", "array?", "object?", "coll?", "seq?", "regexp?", "zero?", "pos?", "neg?", "even?", "odd?", "finite?", "negative-infinity?", "positive-infinity?", "false?", "true?", "empty?", "not-empty?", "vector?", "grid?", "matrix?"];
|
|
11
11
|
readonly regularExpression: readonly ["regexp", "match", "replace", "replace-all"];
|
|
12
12
|
readonly string: readonly ["string-repeat", "str", "number", "lower-case", "upper-case", "trim", "trim-left", "trim-right", "pad-left", "pad-right", "split", "split-lines", "template", "to-char-code", "from-char-code", "encode-base64", "decode-base64", "encode-uri-component", "decode-uri-component", "join", "capitalize", "blank?"];
|
|
13
13
|
readonly bitwise: readonly ["<<", ">>", ">>>", "bit-not", "&", "bit-and-not", "|", "xor", "bit-flip", "bit-clear", "bit-set", "bit-test"];
|
|
@@ -44,7 +44,7 @@ export type NormalExpressionName = CollectionApiName | ArrayApiName | SequenceAp
|
|
|
44
44
|
export type FunctionName = NormalExpressionName | SpecialExpressionsApiName;
|
|
45
45
|
export type ShorthandName = typeof api.shorthand[number];
|
|
46
46
|
export type DatatypeName = typeof api.datatype[number];
|
|
47
|
-
declare const apiNames: readonly ["filter", "map", "reduce", "reduce-right", "reductions", "count", "get", "get-in", "contains?", "assoc", "assoc-in", "++", "not-empty", "every?", "not-every?", "any?", "not-any?", "update", "update-in", "range", "repeat", "flatten", "mapcat", "nth", "push", "pop", "unshift", "shift", "slice", "splice", "position", "index-of", "last-index-of", "some", "reverse", "first", "second", "last", "rest", "next", "take", "take-last", "take-while", "drop", "drop-last", "drop-while", "sort", "sort-by", "distinct", "remove", "remove-at", "split-at", "split-with", "frequencies", "group-by", "partition", "partition-all", "partition-by", "starts-with?", "ends-with?", "interleave", "interpose", "+", "-", "*", "/", "mod", "rem", "quot", "inc", "dec", "sqrt", "cbrt", "^", "round", "trunc", "floor", "ceil", "min", "max", "abs", "sign", "ln", "log2", "log10", "sin", "cos", "tan", "asin", "acos", "atan", "sinh", "cosh", "tanh", "asinh", "acosh", "atanh", "to-rad", "to-deg", "|>", "apply", "identity", "comp", "constantly", "juxt", "complement", "every-pred", "some-pred", "fnull", "≠", "=", "<", ">", "≤", "≥", "!", "write!", "iso-date->epoch", "epoch->iso-date", "boolean", "compare", "identical?", "json-parse", "json-stringify", "dissoc", "keys", "vals", "entries", "find", "merge", "merge-with", "zipmap", "select-keys", "boolean?", "null?", "number?", "string?", "function?", "integer?", "array?", "object?", "coll?", "seq?", "regexp?", "zero?", "pos?", "neg?", "even?", "odd?", "finite?", "nan?", "negative-infinity?", "positive-infinity?", "false?", "true?", "empty?", "not-empty?", "vector?", "grid?", "matrix?", "regexp", "match", "replace", "replace-all", "string-repeat", "str", "number", "lower-case", "upper-case", "trim", "trim-left", "trim-right", "pad-left", "pad-right", "split", "split-lines", "template", "to-char-code", "from-char-code", "encode-base64", "decode-base64", "encode-uri-component", "decode-uri-component", "join", "capitalize", "blank?", "<<", ">>", ">>>", "bit-not", "&", "bit-and-not", "|", "xor", "bit-flip", "bit-clear", "bit-set", "bit-test", "assert", "assert=", "assert!=", "assert-gt", "assert-lt", "assert-gte", "assert-lte", "assert-true", "assert-false", "assert-truthy", "assert-falsy", "assert-null", "assert-throws", "assert-throws-error", "assert-not-throws", "mat:mul", "mat:det", "mat:inv", "mat:adj", "mat:cofactor", "mat:minor", "mat:trace", "mat:symmetric?", "mat:triangular?", "mat:upper-triangular?", "mat:lower-triangular?", "mat:diagonal?", "mat:square?", "mat:orthogonal?", "mat:identity?", "mat:invertible?", "mat:hilbert", "mat:vandermonde", "mat:band", "mat:banded?", "mat:rank", "mat:frobenius-norm", "mat:1-norm", "mat:inf-norm", "mat:max-norm", "vec:monotonic?", "vec:strictly-monotonic?", "vec:increasing?", "vec:decreasing?", "vec:strictly-increasing?", "vec:strictly-decreasing?", "vec:median", "vec:mode", "vec:min-index", "vec:max-index", "vec:sort-indices", "vec:count-values", "vec:linspace", "vec:ones", "vec:zeros", "vec:fill", "vec:generate", "vec:cumsum", "vec:cumprod", "vec:quartiles", "vec:percentile", "vec:quantile", "vec:histogram", "vec:ecdf", "vec:outliers?", "vec:outliers", "vec:bincount", "vec:winsorize", "vec:mse", "vec:mae", "vec:rmse", "vec:smape", "vec:mean", "vec:moving-mean", "vec:centered-moving-mean", "vec:running-mean", "vec:median", "vec:moving-median", "vec:centered-moving-median", "vec:running-median", "vec:variance", "vec:moving-variance", "vec:centered-moving-variance", "vec:running-variance", "vec:sample-variance", "vec:moving-sample-variance", "vec:centered-moving-sample-variance", "vec:running-sample-variance", "vec:sum", "vec:moving-sum", "vec:centered-moving-sum", "vec:running-sum", "vec:prod", "vec:moving-prod", "vec:centered-moving-prod", "vec:running-prod", "vec:min", "vec:moving-min", "vec:centered-moving-min", "vec:running-min", "vec:max", "vec:moving-max", "vec:centered-moving-max", "vec:running-max", "vec:stdev", "vec:moving-stdev", "vec:centered-moving-stdev", "vec:running-stdev", "vec:sample-stdev", "vec:moving-sample-stdev", "vec:centered-moving-sample-stdev", "vec:running-sample-stdev", "vec:iqr", "vec:moving-iqr", "vec:centered-moving-iqr", "vec:running-iqr", "vec:span", "vec:moving-span", "vec:centered-moving-span", "vec:running-span", "vec:geometric-mean", "vec:moving-geometric-mean", "vec:centered-moving-geometric-mean", "vec:running-geometric-mean", "vec:harmonic-mean", "vec:moving-harmonic-mean", "vec:centered-moving-harmonic-mean", "vec:running-harmonic-mean", "vec:skewness", "vec:moving-skewness", "vec:centered-moving-skewness", "vec:running-skewness", "vec:sample-skewness", "vec:moving-sample-skewness", "vec:centered-moving-sample-skewness", "vec:running-sample-skewness", "vec:kurtosis", "vec:moving-kurtosis", "vec:centered-moving-kurtosis", "vec:running-kurtosis", "vec:sample-kurtosis", "vec:moving-sample-kurtosis", "vec:centered-moving-sample-kurtosis", "vec:running-sample-kurtosis", "vec:excess-kurtosis", "vec:moving-excess-kurtosis", "vec:centered-moving-excess-kurtosis", "vec:running-excess-kurtosis", "vec:sample-excess-kurtosis", "vec:moving-sample-excess-kurtosis", "vec:centered-moving-sample-excess-kurtosis", "vec:running-sample-excess-kurtosis", "vec:rms", "vec:moving-rms", "vec:centered-moving-rms", "vec:running-rms", "vec:mad", "vec:moving-mad", "vec:centered-moving-mad", "vec:running-mad", "vec:medad", "vec:moving-medad", "vec:centered-moving-medad", "vec:running-medad", "vec:gini-coefficient", "vec:moving-gini-coefficient", "vec:centered-moving-gini-coefficient", "vec:running-gini-coefficient", "vec:entropy", "vec:moving-entropy", "vec:centered-moving-entropy", "vec:running-entropy", "vec:skewness", "vec:moving-skewness", "vec:centered-moving-skewness", "vec:running-skewness", "lin:reflect", "lin:refract", "lin:lerp", "lin:rotate2d", "lin:rotate3d", "lin:dot", "lin:cross", "lin:normalize-minmax", "lin:normalize-zscore", "lin:normalize-robust", "lin:normalize-l1", "lin:normalize-l2", "lin:normalize-log", "lin:angle", "lin:projection", "lin:orthogonal?", "lin:parallel?", "lin:collinear?", "lin:cosine-similarity", "lin:euclidean-distance", "lin:euclidean-norm", "lin:manhattan-distance", "lin:manhattan-norm", "lin:hamming-distance", "lin:hamming-norm", "lin:chebyshev-distance", "lin:chebyshev-norm", "lin:minkowski-distance", "lin:minkowski-norm", "lin:cov", "lin:corr", "lin:spearman-corr", "lin:pearson-corr", "lin:kendall-tau", "lin:autocorrelation", "lin:cross-correlation", "lin:rref", "lin:solve", "lin:to-polar", "lin:from-polar", "grid:every?", "grid:some?", "grid:every-row?", "grid:some-row?", "grid:every-col?", "grid:some-col?", "grid:row", "grid:col", "grid:shape", "grid:fill", "grid:generate", "grid:reshape", "grid:transpose", "grid:flip-h", "grid:flip-v", "grid:rotate", "grid:reverse-rows", "grid:reverse-cols", "grid:slice", "grid:slice-rows", "grid:slice-cols", "grid:splice-rows", "grid:splice-cols", "grid:concat-rows", "grid:concat-cols", "grid:map", "grid:mapi", "grid:reduce", "grid:reducei", "grid:push-rows", "grid:unshift-rows", "grid:pop-row", "grid:shift-row", "grid:push-cols", "grid:unshift-cols", "grid:pop-col", "grid:shift-col", "grid:from-array", "nth:abundant-seq", "nth:abundant-nth", "nth:abundant-take-while", "nth:abundant?", "nth:bell-seq", "nth:bell-nth", "nth:bell-take-while", "nth:bell?", "nth:catalan-seq", "nth:catalan-nth", "nth:catalan-take-while", "nth:catalan?", "nth:composite-seq", "nth:composite-nth", "nth:composite-take-while", "nth:composite?", "nth:factorial-seq", "nth:factorial-nth", "nth:factorial-take-while", "nth:factorial?", "nth:fibonacci-seq", "nth:fibonacci-nth", "nth:fibonacci-take-while", "nth:fibonacci?", "nth:geometric-seq", "nth:geometric-nth", "nth:geometric-take-while", "nth:geometric?", "nth:golomb-seq", "nth:golomb-nth", "nth:golomb-take-while", "nth:golomb?", "nth:happy-seq", "nth:happy-nth", "nth:happy-take-while", "nth:happy?", "nth:look-and-say-seq", "nth:look-and-say-nth", "nth:look-and-say-take-while", "nth:look-and-say?", "nth:lucas-seq", "nth:lucas-nth", "nth:lucas-take-while", "nth:lucas?", "nth:lucky-seq", "nth:lucky-nth", "nth:lucky-take-while", "nth:lucky?", "nth:mersenne-seq", "nth:mersenne-nth", "nth:mersenne-take-while", "nth:mersenne?", "nth:padovan-seq", "nth:padovan-nth", "nth:padovan-take-while", "nth:padovan?", "nth:partition-seq", "nth:partition-nth", "nth:partition-take-while", "nth:partition?", "nth:pell-seq", "nth:pell-nth", "nth:pell-take-while", "nth:pell?", "nth:perfect-seq", "nth:perfect-nth", "nth:perfect-take-while", "nth:perfect?", "nth:perfect-cube-seq", "nth:perfect-cube-nth", "nth:perfect-cube-take-while", "nth:perfect-cube?", "nth:perfect-power-seq", "nth:perfect-power-nth", "nth:perfect-power-take-while", "nth:perfect-power?", "nth:perfect-square-seq", "nth:perfect-square-nth", "nth:perfect-square-take-while", "nth:perfect-square?", "nth:polygonal-seq", "nth:polygonal-nth", "nth:polygonal-take-while", "nth:polygonal?", "nth:prime-seq", "nth:prime-nth", "nth:prime-take-while", "nth:prime?", "nth:recaman-seq", "nth:recaman-nth", "nth:recaman-take-while", "nth:recaman?", "nth:sylvester-seq", "nth:sylvester-nth", "nth:sylvester-take-while", "nth:sylvester?", "nth:thue-morse-seq", "nth:thue-morse-nth", "nth:thue-morse-take-while", "nth:thue-morse?", "nth:tribonacci-seq", "nth:tribonacci-nth", "nth:tribonacci-take-while", "nth:tribonacci?", "nth:collatz-seq", "nth:juggler-seq", "nth:bernoulli-seq", "nth:bernoulli-take-while", "nth:bernoulli-nth", "nth:combinations", "nth:count-combinations", "nth:derangements", "nth:count-derangements", "nth:divisors", "nth:count-divisors", "nth:proper-divisors", "nth:count-proper-divisors", "nth:prime-factors", "nth:count-prime-factors", "nth:distinct-prime-factors", "nth:count-distinct-prime-factors", "nth:factorial", "nth:partitions", "nth:count-partitions", "nth:permutations", "nth:count-permutations", "nth:power-set", "nth:count-power-set", "nth:coprime?", "nth:divisible-by?", "nth:gcd", "nth:lcm", "nth:multinomial", "nth:amicable?", "nth:euler-totient", "nth:mobius", "nth:mertens", "nth:sigma", "nth:carmichael-lambda", "nth:cartesian-product", "nth:perfect-power", "nth:mod-exp", "nth:mod-inv", "nth:extended-gcd", "nth:chinese-remainder", "nth:stirling-first", "nth:stirling-second", "!:random", "!:random-int", "!:random-int-inclusive", "!:random-float", "!:random-boolean", "!:random-item", "!:random-sample", "!:random-sample-unique", "!:shuffle", "!:random-normal", "!:random-exponential", "!:random-binomial", "!:random-poisson", "!:random-gamma", "!:random-pareto", "!:uuid", "!:random-char", "!:random-string", "!:random-id", "!:random-color", "-short-regexp", "-short-fn", "-type-number", "-type-string", "-type-object", "-type-array", "-type-vector", "-type-matrix", "-type-grid", "-type-boolean", "-type-function", "-type-integer", "-type-any", "-type-null", "-type-collection", "-type-sequence", "-type-regexp", "-type-never"];
|
|
47
|
+
declare const apiNames: readonly ["filter", "filteri", "map", "mapi", "reduce", "reducei", "reduce-right", "reducei-right", "reductions", "reductionsi", "count", "get", "get-in", "contains?", "assoc", "assoc-in", "++", "not-empty", "every?", "not-every?", "any?", "not-any?", "update", "update-in", "range", "repeat", "flatten", "mapcat", "moving-fn", "running-fn", "nth", "push", "pop", "unshift", "shift", "slice", "splice", "position", "index-of", "last-index-of", "some", "reverse", "first", "second", "last", "rest", "next", "take", "take-last", "take-while", "drop", "drop-last", "drop-while", "sort", "sort-by", "distinct", "remove", "remove-at", "split-at", "split-with", "frequencies", "group-by", "partition", "partition-all", "partition-by", "starts-with?", "ends-with?", "interleave", "interpose", "+", "-", "*", "/", "mod", "rem", "quot", "inc", "dec", "sqrt", "cbrt", "^", "round", "trunc", "floor", "ceil", "min", "max", "abs", "sign", "ln", "log2", "log10", "sin", "cos", "tan", "asin", "acos", "atan", "sinh", "cosh", "tanh", "asinh", "acosh", "atanh", "to-rad", "to-deg", "|>", "apply", "identity", "comp", "constantly", "juxt", "complement", "every-pred", "some-pred", "fnull", "≠", "=", "<", ">", "≤", "≥", "!", "write!", "iso-date->epoch", "epoch->iso-date", "boolean", "compare", "identical?", "json-parse", "json-stringify", "dissoc", "keys", "vals", "entries", "find", "merge", "merge-with", "zipmap", "select-keys", "boolean?", "null?", "number?", "string?", "function?", "integer?", "array?", "object?", "coll?", "seq?", "regexp?", "zero?", "pos?", "neg?", "even?", "odd?", "finite?", "negative-infinity?", "positive-infinity?", "false?", "true?", "empty?", "not-empty?", "vector?", "grid?", "matrix?", "regexp", "match", "replace", "replace-all", "string-repeat", "str", "number", "lower-case", "upper-case", "trim", "trim-left", "trim-right", "pad-left", "pad-right", "split", "split-lines", "template", "to-char-code", "from-char-code", "encode-base64", "decode-base64", "encode-uri-component", "decode-uri-component", "join", "capitalize", "blank?", "<<", ">>", ">>>", "bit-not", "&", "bit-and-not", "|", "xor", "bit-flip", "bit-clear", "bit-set", "bit-test", "assert", "assert=", "assert!=", "assert-gt", "assert-lt", "assert-gte", "assert-lte", "assert-true", "assert-false", "assert-truthy", "assert-falsy", "assert-null", "assert-throws", "assert-throws-error", "assert-not-throws", "mat:mul", "mat:det", "mat:inv", "mat:adj", "mat:cofactor", "mat:minor", "mat:trace", "mat:symmetric?", "mat:triangular?", "mat:upper-triangular?", "mat:lower-triangular?", "mat:diagonal?", "mat:square?", "mat:orthogonal?", "mat:identity?", "mat:invertible?", "mat:hilbert", "mat:vandermonde", "mat:band", "mat:banded?", "mat:rank", "mat:frobenius-norm", "mat:1-norm", "mat:inf-norm", "mat:max-norm", "vec:monotonic?", "vec:strictly-monotonic?", "vec:increasing?", "vec:decreasing?", "vec:strictly-increasing?", "vec:strictly-decreasing?", "vec:median", "vec:mode", "vec:min-index", "vec:max-index", "vec:sort-indices", "vec:count-values", "vec:linspace", "vec:ones", "vec:zeros", "vec:fill", "vec:generate", "vec:cumsum", "vec:cumprod", "vec:quartiles", "vec:percentile", "vec:quantile", "vec:histogram", "vec:ecdf", "vec:outliers?", "vec:outliers", "vec:bincount", "vec:winsorize", "vec:mse", "vec:mae", "vec:rmse", "vec:smape", "vec:mean", "vec:moving-mean", "vec:centered-moving-mean", "vec:running-mean", "vec:median", "vec:moving-median", "vec:centered-moving-median", "vec:running-median", "vec:variance", "vec:moving-variance", "vec:centered-moving-variance", "vec:running-variance", "vec:sample-variance", "vec:moving-sample-variance", "vec:centered-moving-sample-variance", "vec:running-sample-variance", "vec:sum", "vec:moving-sum", "vec:centered-moving-sum", "vec:running-sum", "vec:prod", "vec:moving-prod", "vec:centered-moving-prod", "vec:running-prod", "vec:min", "vec:moving-min", "vec:centered-moving-min", "vec:running-min", "vec:max", "vec:moving-max", "vec:centered-moving-max", "vec:running-max", "vec:stdev", "vec:moving-stdev", "vec:centered-moving-stdev", "vec:running-stdev", "vec:sample-stdev", "vec:moving-sample-stdev", "vec:centered-moving-sample-stdev", "vec:running-sample-stdev", "vec:iqr", "vec:moving-iqr", "vec:centered-moving-iqr", "vec:running-iqr", "vec:span", "vec:moving-span", "vec:centered-moving-span", "vec:running-span", "vec:geometric-mean", "vec:moving-geometric-mean", "vec:centered-moving-geometric-mean", "vec:running-geometric-mean", "vec:harmonic-mean", "vec:moving-harmonic-mean", "vec:centered-moving-harmonic-mean", "vec:running-harmonic-mean", "vec:skewness", "vec:moving-skewness", "vec:centered-moving-skewness", "vec:running-skewness", "vec:sample-skewness", "vec:moving-sample-skewness", "vec:centered-moving-sample-skewness", "vec:running-sample-skewness", "vec:kurtosis", "vec:moving-kurtosis", "vec:centered-moving-kurtosis", "vec:running-kurtosis", "vec:sample-kurtosis", "vec:moving-sample-kurtosis", "vec:centered-moving-sample-kurtosis", "vec:running-sample-kurtosis", "vec:excess-kurtosis", "vec:moving-excess-kurtosis", "vec:centered-moving-excess-kurtosis", "vec:running-excess-kurtosis", "vec:sample-excess-kurtosis", "vec:moving-sample-excess-kurtosis", "vec:centered-moving-sample-excess-kurtosis", "vec:running-sample-excess-kurtosis", "vec:rms", "vec:moving-rms", "vec:centered-moving-rms", "vec:running-rms", "vec:mad", "vec:moving-mad", "vec:centered-moving-mad", "vec:running-mad", "vec:medad", "vec:moving-medad", "vec:centered-moving-medad", "vec:running-medad", "vec:gini-coefficient", "vec:moving-gini-coefficient", "vec:centered-moving-gini-coefficient", "vec:running-gini-coefficient", "vec:entropy", "vec:moving-entropy", "vec:centered-moving-entropy", "vec:running-entropy", "vec:skewness", "vec:moving-skewness", "vec:centered-moving-skewness", "vec:running-skewness", "lin:reflect", "lin:refract", "lin:lerp", "lin:rotate2d", "lin:rotate3d", "lin:dot", "lin:cross", "lin:normalize-minmax", "lin:normalize-zscore", "lin:normalize-robust", "lin:normalize-l1", "lin:normalize-l2", "lin:normalize-log", "lin:angle", "lin:projection", "lin:orthogonal?", "lin:parallel?", "lin:collinear?", "lin:cosine-similarity", "lin:euclidean-distance", "lin:euclidean-norm", "lin:manhattan-distance", "lin:manhattan-norm", "lin:hamming-distance", "lin:hamming-norm", "lin:chebyshev-distance", "lin:chebyshev-norm", "lin:minkowski-distance", "lin:minkowski-norm", "lin:cov", "lin:corr", "lin:spearman-corr", "lin:pearson-corr", "lin:kendall-tau", "lin:autocorrelation", "lin:cross-correlation", "lin:rref", "lin:solve", "lin:to-polar", "lin:from-polar", "grid:every?", "grid:some?", "grid:every-row?", "grid:some-row?", "grid:every-col?", "grid:some-col?", "grid:row", "grid:col", "grid:shape", "grid:fill", "grid:generate", "grid:reshape", "grid:transpose", "grid:flip-h", "grid:flip-v", "grid:rotate", "grid:reverse-rows", "grid:reverse-cols", "grid:slice", "grid:slice-rows", "grid:slice-cols", "grid:splice-rows", "grid:splice-cols", "grid:concat-rows", "grid:concat-cols", "grid:map", "grid:mapi", "grid:reduce", "grid:reducei", "grid:push-rows", "grid:unshift-rows", "grid:pop-row", "grid:shift-row", "grid:push-cols", "grid:unshift-cols", "grid:pop-col", "grid:shift-col", "grid:from-array", "nth:abundant-seq", "nth:abundant-nth", "nth:abundant-take-while", "nth:abundant?", "nth:bell-seq", "nth:bell-nth", "nth:bell-take-while", "nth:bell?", "nth:catalan-seq", "nth:catalan-nth", "nth:catalan-take-while", "nth:catalan?", "nth:composite-seq", "nth:composite-nth", "nth:composite-take-while", "nth:composite?", "nth:factorial-seq", "nth:factorial-nth", "nth:factorial-take-while", "nth:factorial?", "nth:fibonacci-seq", "nth:fibonacci-nth", "nth:fibonacci-take-while", "nth:fibonacci?", "nth:geometric-seq", "nth:geometric-nth", "nth:geometric-take-while", "nth:geometric?", "nth:golomb-seq", "nth:golomb-nth", "nth:golomb-take-while", "nth:golomb?", "nth:happy-seq", "nth:happy-nth", "nth:happy-take-while", "nth:happy?", "nth:look-and-say-seq", "nth:look-and-say-nth", "nth:look-and-say-take-while", "nth:look-and-say?", "nth:lucas-seq", "nth:lucas-nth", "nth:lucas-take-while", "nth:lucas?", "nth:lucky-seq", "nth:lucky-nth", "nth:lucky-take-while", "nth:lucky?", "nth:mersenne-seq", "nth:mersenne-nth", "nth:mersenne-take-while", "nth:mersenne?", "nth:padovan-seq", "nth:padovan-nth", "nth:padovan-take-while", "nth:padovan?", "nth:partition-seq", "nth:partition-nth", "nth:partition-take-while", "nth:partition?", "nth:pell-seq", "nth:pell-nth", "nth:pell-take-while", "nth:pell?", "nth:perfect-seq", "nth:perfect-nth", "nth:perfect-take-while", "nth:perfect?", "nth:perfect-cube-seq", "nth:perfect-cube-nth", "nth:perfect-cube-take-while", "nth:perfect-cube?", "nth:perfect-power-seq", "nth:perfect-power-nth", "nth:perfect-power-take-while", "nth:perfect-power?", "nth:perfect-square-seq", "nth:perfect-square-nth", "nth:perfect-square-take-while", "nth:perfect-square?", "nth:polygonal-seq", "nth:polygonal-nth", "nth:polygonal-take-while", "nth:polygonal?", "nth:prime-seq", "nth:prime-nth", "nth:prime-take-while", "nth:prime?", "nth:recaman-seq", "nth:recaman-nth", "nth:recaman-take-while", "nth:recaman?", "nth:sylvester-seq", "nth:sylvester-nth", "nth:sylvester-take-while", "nth:sylvester?", "nth:thue-morse-seq", "nth:thue-morse-nth", "nth:thue-morse-take-while", "nth:thue-morse?", "nth:tribonacci-seq", "nth:tribonacci-nth", "nth:tribonacci-take-while", "nth:tribonacci?", "nth:collatz-seq", "nth:juggler-seq", "nth:bernoulli-seq", "nth:bernoulli-take-while", "nth:bernoulli-nth", "nth:combinations", "nth:count-combinations", "nth:derangements", "nth:count-derangements", "nth:divisors", "nth:count-divisors", "nth:proper-divisors", "nth:count-proper-divisors", "nth:prime-factors", "nth:count-prime-factors", "nth:distinct-prime-factors", "nth:count-distinct-prime-factors", "nth:factorial", "nth:partitions", "nth:count-partitions", "nth:permutations", "nth:count-permutations", "nth:power-set", "nth:count-power-set", "nth:coprime?", "nth:divisible-by?", "nth:gcd", "nth:lcm", "nth:multinomial", "nth:amicable?", "nth:euler-totient", "nth:mobius", "nth:mertens", "nth:sigma", "nth:carmichael-lambda", "nth:cartesian-product", "nth:perfect-power", "nth:mod-exp", "nth:mod-inv", "nth:extended-gcd", "nth:chinese-remainder", "nth:stirling-first", "nth:stirling-second", "!:random", "!:random-int", "!:random-int-inclusive", "!:random-float", "!:random-boolean", "!:random-item", "!:random-sample", "!:random-sample-unique", "!:shuffle", "!:random-normal", "!:random-exponential", "!:random-binomial", "!:random-poisson", "!:random-gamma", "!:random-pareto", "!:uuid", "!:random-char", "!:random-string", "!:random-id", "!:random-color", "-short-regexp", "-short-fn", "-type-number", "-type-string", "-type-object", "-type-array", "-type-vector", "-type-matrix", "-type-grid", "-type-boolean", "-type-function", "-type-integer", "-type-any", "-type-null", "-type-collection", "-type-sequence", "-type-regexp", "-type-never"];
|
|
48
48
|
export type ApiName = typeof apiNames[number];
|
|
49
49
|
export declare function isApiName(arg: string): arg is ApiName;
|
|
50
50
|
export declare const categoryRecord: {
|
|
@@ -87,8 +87,13 @@ export declare const functionReference: {
|
|
|
87
87
|
split: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
88
88
|
trim: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
89
89
|
repeat: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
90
|
+
filteri: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
91
|
+
mapi: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
92
|
+
reducei: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
90
93
|
"reduce-right": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
94
|
+
"reducei-right": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
91
95
|
reductions: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
96
|
+
reductionsi: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
92
97
|
get: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
93
98
|
"get-in": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
94
99
|
"contains?": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
@@ -105,6 +110,8 @@ export declare const functionReference: {
|
|
|
105
110
|
range: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
106
111
|
flatten: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
107
112
|
mapcat: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
113
|
+
"moving-fn": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
114
|
+
"running-fn": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
108
115
|
second: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
109
116
|
nth: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
110
117
|
last: FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
@@ -221,7 +228,6 @@ export declare const functionReference: {
|
|
|
221
228
|
"object?": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
222
229
|
"regexp?": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
223
230
|
"finite?": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
224
|
-
"nan?": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
225
231
|
"positive-infinity?": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
226
232
|
"negative-infinity?": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
227
233
|
"true?": FunctionReference<"String" | "Array" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Object" | "Math" | "Functional" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Vector" | "Linear Algebra" | "Matrix" | "Grid" | "Number Theory" | "Random" | "Shorthand" | "Datatype">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const binaryOperators: readonly ["^", "*", "/", "%", "+", "-", "<<", ">>", ">>>", "++", "<", "<=", "≤", ">", ">=", "≥", "=", "!=", "≠", "&", "xor", "|", "&&", "||", "??", "|>"];
|
|
2
|
-
declare const symbolicOperators: readonly ["^", "*", "/", "%", "+", "-", "<<", ">>", ">>>", "++", "<", "<=", "≤", ">", ">=", "≥", "=", "!=", "≠", "&", "xor", "|", "&&", "||", "??", "|>", "->", "...", ".", ",", ":=", ";"];
|
|
2
|
+
declare const symbolicOperators: readonly ["^", "*", "/", "%", "+", "-", "<<", ">>", ">>>", "++", "<", "<=", "≤", ">", ">=", "≥", "=", "!=", "≠", "&", "xor", "|", "&&", "||", "??", "|>", "?", ":", "->", "...", ".", ",", ":=", ";"];
|
|
3
3
|
export declare function isFunctionOperator(operator: string): boolean;
|
|
4
4
|
export type SymbolicBinaryOperator = typeof binaryOperators[number];
|
|
5
5
|
export type SymbolicOperator = typeof symbolicOperators[number];
|
|
@@ -446,6 +446,8 @@ function isNumber(value, options) {
|
|
|
446
446
|
if (options === void 0) { options = {}; }
|
|
447
447
|
if (typeof value !== 'number')
|
|
448
448
|
return false;
|
|
449
|
+
if (Number.isNaN(value))
|
|
450
|
+
return false;
|
|
449
451
|
if (options.integer && !Number.isInteger(value))
|
|
450
452
|
return false;
|
|
451
453
|
if (options.finite && !Number.isFinite(value))
|
|
@@ -1066,6 +1068,35 @@ var collectionNormalExpression = {
|
|
|
1066
1068
|
},
|
|
1067
1069
|
paramCount: 2,
|
|
1068
1070
|
},
|
|
1071
|
+
'filteri': {
|
|
1072
|
+
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
1073
|
+
var _c = __read(_a, 2), coll = _c[0], fn = _c[1];
|
|
1074
|
+
var executeFunction = _b.executeFunction;
|
|
1075
|
+
assertColl(coll, sourceCodeInfo);
|
|
1076
|
+
assertFunctionLike(fn, sourceCodeInfo);
|
|
1077
|
+
if (Array.isArray(coll)) {
|
|
1078
|
+
var result = coll.filter(function (elem, index) { return executeFunction(fn, [elem, index], contextStack, sourceCodeInfo); });
|
|
1079
|
+
return result;
|
|
1080
|
+
}
|
|
1081
|
+
if (isString(coll)) {
|
|
1082
|
+
return coll
|
|
1083
|
+
.split('')
|
|
1084
|
+
.filter(function (elem, index) { return executeFunction(fn, [elem, index], contextStack, sourceCodeInfo); })
|
|
1085
|
+
.join('');
|
|
1086
|
+
}
|
|
1087
|
+
return Object.entries(coll)
|
|
1088
|
+
.filter(function (_a) {
|
|
1089
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
1090
|
+
return executeFunction(fn, [value, key], contextStack, sourceCodeInfo);
|
|
1091
|
+
})
|
|
1092
|
+
.reduce(function (result, _a) {
|
|
1093
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
1094
|
+
result[key] = value;
|
|
1095
|
+
return result;
|
|
1096
|
+
}, {});
|
|
1097
|
+
},
|
|
1098
|
+
paramCount: 2,
|
|
1099
|
+
},
|
|
1069
1100
|
'map': {
|
|
1070
1101
|
evaluate: function (params, sourceCodeInfo, contextStack, _a) {
|
|
1071
1102
|
var executeFunction = _a.executeFunction;
|
|
@@ -1108,6 +1139,30 @@ var collectionNormalExpression = {
|
|
|
1108
1139
|
},
|
|
1109
1140
|
paramCount: { min: 2 },
|
|
1110
1141
|
},
|
|
1142
|
+
'mapi': {
|
|
1143
|
+
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
1144
|
+
var _c = __read(_a, 2), coll = _c[0], fn = _c[1];
|
|
1145
|
+
var executeFunction = _b.executeFunction;
|
|
1146
|
+
assertColl(coll, sourceCodeInfo);
|
|
1147
|
+
assertFunctionLike(fn, sourceCodeInfo);
|
|
1148
|
+
if (Array.isArray(coll)) {
|
|
1149
|
+
return coll.map(function (elem, index) { return executeFunction(fn, [elem, index], contextStack, sourceCodeInfo); });
|
|
1150
|
+
}
|
|
1151
|
+
if (isString(coll)) {
|
|
1152
|
+
return coll
|
|
1153
|
+
.split('')
|
|
1154
|
+
.map(function (elem, index) { return executeFunction(fn, [elem, index], contextStack, sourceCodeInfo); })
|
|
1155
|
+
.join('');
|
|
1156
|
+
}
|
|
1157
|
+
return Object.entries(coll)
|
|
1158
|
+
.reduce(function (acc, _a) {
|
|
1159
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
1160
|
+
acc[key] = executeFunction(fn, [value, key], contextStack, sourceCodeInfo);
|
|
1161
|
+
return acc;
|
|
1162
|
+
}, {});
|
|
1163
|
+
},
|
|
1164
|
+
paramCount: 2,
|
|
1165
|
+
},
|
|
1111
1166
|
'reduce': {
|
|
1112
1167
|
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
1113
1168
|
var _c = __read(_a, 3), coll = _c[0], fn = _c[1], initial = _c[2];
|
|
@@ -1141,6 +1196,39 @@ var collectionNormalExpression = {
|
|
|
1141
1196
|
},
|
|
1142
1197
|
paramCount: 3,
|
|
1143
1198
|
},
|
|
1199
|
+
'reducei': {
|
|
1200
|
+
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
1201
|
+
var _c = __read(_a, 3), coll = _c[0], fn = _c[1], initial = _c[2];
|
|
1202
|
+
var executeFunction = _b.executeFunction;
|
|
1203
|
+
assertColl(coll, sourceCodeInfo);
|
|
1204
|
+
assertFunctionLike(fn, sourceCodeInfo);
|
|
1205
|
+
assertAny(initial, sourceCodeInfo);
|
|
1206
|
+
if (typeof coll === 'string') {
|
|
1207
|
+
assertString(initial, sourceCodeInfo);
|
|
1208
|
+
if (coll.length === 0)
|
|
1209
|
+
return initial;
|
|
1210
|
+
return coll.split('').reduce(function (result, elem, index) {
|
|
1211
|
+
return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo);
|
|
1212
|
+
}, initial);
|
|
1213
|
+
}
|
|
1214
|
+
else if (Array.isArray(coll)) {
|
|
1215
|
+
if (coll.length === 0)
|
|
1216
|
+
return initial;
|
|
1217
|
+
return coll.reduce(function (result, elem, index) {
|
|
1218
|
+
return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo);
|
|
1219
|
+
}, initial);
|
|
1220
|
+
}
|
|
1221
|
+
else {
|
|
1222
|
+
if (Object.keys(coll).length === 0)
|
|
1223
|
+
return initial;
|
|
1224
|
+
return Object.entries(coll).reduce(function (result, _a) {
|
|
1225
|
+
var _b = __read(_a, 2), key = _b[0], elem = _b[1];
|
|
1226
|
+
return executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo);
|
|
1227
|
+
}, initial);
|
|
1228
|
+
}
|
|
1229
|
+
},
|
|
1230
|
+
paramCount: 3,
|
|
1231
|
+
},
|
|
1144
1232
|
'reduce-right': {
|
|
1145
1233
|
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
1146
1234
|
var _c = __read(_a, 3), coll = _c[0], fn = _c[1], initial = _c[2];
|
|
@@ -1173,6 +1261,38 @@ var collectionNormalExpression = {
|
|
|
1173
1261
|
},
|
|
1174
1262
|
paramCount: 3,
|
|
1175
1263
|
},
|
|
1264
|
+
'reducei-right': {
|
|
1265
|
+
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
1266
|
+
var _c = __read(_a, 3), coll = _c[0], fn = _c[1], initial = _c[2];
|
|
1267
|
+
var executeFunction = _b.executeFunction;
|
|
1268
|
+
assertColl(coll, sourceCodeInfo);
|
|
1269
|
+
assertFunctionLike(fn, sourceCodeInfo);
|
|
1270
|
+
assertAny(initial, sourceCodeInfo);
|
|
1271
|
+
if (typeof coll === 'string') {
|
|
1272
|
+
if (coll.length === 0)
|
|
1273
|
+
return initial;
|
|
1274
|
+
return coll.split('').reduceRight(function (result, elem, index) {
|
|
1275
|
+
return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo);
|
|
1276
|
+
}, initial);
|
|
1277
|
+
}
|
|
1278
|
+
else if (Array.isArray(coll)) {
|
|
1279
|
+
if (coll.length === 0)
|
|
1280
|
+
return initial;
|
|
1281
|
+
return coll.reduceRight(function (result, elem, index) {
|
|
1282
|
+
return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo);
|
|
1283
|
+
}, initial);
|
|
1284
|
+
}
|
|
1285
|
+
else {
|
|
1286
|
+
if (Object.keys(coll).length === 0)
|
|
1287
|
+
return initial;
|
|
1288
|
+
return Object.entries(coll).reduceRight(function (result, _a) {
|
|
1289
|
+
var _b = __read(_a, 2), key = _b[0], elem = _b[1];
|
|
1290
|
+
return executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo);
|
|
1291
|
+
}, initial);
|
|
1292
|
+
}
|
|
1293
|
+
},
|
|
1294
|
+
paramCount: 3,
|
|
1295
|
+
},
|
|
1176
1296
|
'reductions': {
|
|
1177
1297
|
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
1178
1298
|
var _c = __read(_a, 3), coll = _c[0], fn = _c[1], initial = _c[2];
|
|
@@ -1219,6 +1339,52 @@ var collectionNormalExpression = {
|
|
|
1219
1339
|
},
|
|
1220
1340
|
paramCount: 3,
|
|
1221
1341
|
},
|
|
1342
|
+
'reductionsi': {
|
|
1343
|
+
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
1344
|
+
var _c = __read(_a, 3), coll = _c[0], fn = _c[1], initial = _c[2];
|
|
1345
|
+
var executeFunction = _b.executeFunction;
|
|
1346
|
+
assertColl(coll, sourceCodeInfo);
|
|
1347
|
+
assertFunctionLike(fn, sourceCodeInfo);
|
|
1348
|
+
assertAny(initial, sourceCodeInfo);
|
|
1349
|
+
assertAny(initial, sourceCodeInfo);
|
|
1350
|
+
if (typeof coll === 'string') {
|
|
1351
|
+
assertString(initial, sourceCodeInfo);
|
|
1352
|
+
if (coll.length === 0)
|
|
1353
|
+
return [initial];
|
|
1354
|
+
var resultArray_4 = [initial];
|
|
1355
|
+
coll.split('').reduce(function (result, elem, index) {
|
|
1356
|
+
var newVal = executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo);
|
|
1357
|
+
resultArray_4.push(newVal);
|
|
1358
|
+
return newVal;
|
|
1359
|
+
}, initial);
|
|
1360
|
+
return resultArray_4;
|
|
1361
|
+
}
|
|
1362
|
+
else if (Array.isArray(coll)) {
|
|
1363
|
+
if (coll.length === 0)
|
|
1364
|
+
return [initial];
|
|
1365
|
+
var resultArray_5 = [initial];
|
|
1366
|
+
coll.reduce(function (result, elem, index) {
|
|
1367
|
+
var newVal = executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo);
|
|
1368
|
+
resultArray_5.push(newVal);
|
|
1369
|
+
return newVal;
|
|
1370
|
+
}, initial);
|
|
1371
|
+
return resultArray_5;
|
|
1372
|
+
}
|
|
1373
|
+
else {
|
|
1374
|
+
if (Object.keys(coll).length === 0)
|
|
1375
|
+
return [initial];
|
|
1376
|
+
var resultArray_6 = [initial];
|
|
1377
|
+
Object.entries(coll).reduce(function (result, _a) {
|
|
1378
|
+
var _b = __read(_a, 2), key = _b[0], elem = _b[1];
|
|
1379
|
+
var newVal = executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo);
|
|
1380
|
+
resultArray_6.push(newVal);
|
|
1381
|
+
return newVal;
|
|
1382
|
+
}, initial);
|
|
1383
|
+
return resultArray_6;
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
paramCount: 3,
|
|
1387
|
+
},
|
|
1222
1388
|
'get': {
|
|
1223
1389
|
evaluate: function (params, sourceCodeInfo) {
|
|
1224
1390
|
var _a = __read(params, 2), coll = _a[0], key = _a[1];
|
|
@@ -1472,7 +1638,7 @@ var collectionNormalExpression = {
|
|
|
1472
1638
|
};
|
|
1473
1639
|
|
|
1474
1640
|
var arrayNormalExpression = {
|
|
1475
|
-
range: {
|
|
1641
|
+
'range': {
|
|
1476
1642
|
evaluate: function (params, sourceCodeInfo) {
|
|
1477
1643
|
var _a = __read(params, 3), first = _a[0], second = _a[1], third = _a[2];
|
|
1478
1644
|
var from;
|
|
@@ -1510,7 +1676,7 @@ var arrayNormalExpression = {
|
|
|
1510
1676
|
},
|
|
1511
1677
|
paramCount: { min: 1, max: 3 },
|
|
1512
1678
|
},
|
|
1513
|
-
repeat: {
|
|
1679
|
+
'repeat': {
|
|
1514
1680
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1515
1681
|
var _b = __read(_a, 2), value = _b[0], count = _b[1];
|
|
1516
1682
|
assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true });
|
|
@@ -1521,7 +1687,7 @@ var arrayNormalExpression = {
|
|
|
1521
1687
|
},
|
|
1522
1688
|
paramCount: 2,
|
|
1523
1689
|
},
|
|
1524
|
-
flatten: {
|
|
1690
|
+
'flatten': {
|
|
1525
1691
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1526
1692
|
var _b = __read(_a, 2), seq = _b[0], depth = _b[1];
|
|
1527
1693
|
assertArray(seq, sourceCodeInfo);
|
|
@@ -1532,7 +1698,7 @@ var arrayNormalExpression = {
|
|
|
1532
1698
|
},
|
|
1533
1699
|
paramCount: { min: 1, max: 2 },
|
|
1534
1700
|
},
|
|
1535
|
-
mapcat: {
|
|
1701
|
+
'mapcat': {
|
|
1536
1702
|
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
1537
1703
|
var _c = __read(_a, 2), arr = _c[0], fn = _c[1];
|
|
1538
1704
|
var executeFunction = _b.executeFunction;
|
|
@@ -1542,6 +1708,38 @@ var arrayNormalExpression = {
|
|
|
1542
1708
|
},
|
|
1543
1709
|
paramCount: 2,
|
|
1544
1710
|
},
|
|
1711
|
+
'moving-fn': {
|
|
1712
|
+
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
1713
|
+
var _c = __read(_a, 3), arr = _c[0], windowSize = _c[1], fn = _c[2];
|
|
1714
|
+
var executeFunction = _b.executeFunction;
|
|
1715
|
+
assertArray(arr, sourceCodeInfo);
|
|
1716
|
+
assertNumber(windowSize, sourceCodeInfo, { integer: true, lte: arr.length });
|
|
1717
|
+
assertFunctionLike(fn, sourceCodeInfo);
|
|
1718
|
+
var result = [];
|
|
1719
|
+
for (var i = 0; i <= arr.length - windowSize; i++) {
|
|
1720
|
+
var window_1 = arr.slice(i, i + windowSize);
|
|
1721
|
+
var value = executeFunction(fn, [window_1], contextStack, sourceCodeInfo);
|
|
1722
|
+
result.push(value);
|
|
1723
|
+
}
|
|
1724
|
+
return result;
|
|
1725
|
+
},
|
|
1726
|
+
paramCount: 3,
|
|
1727
|
+
},
|
|
1728
|
+
'running-fn': {
|
|
1729
|
+
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
1730
|
+
var _c = __read(_a, 2), arr = _c[0], fn = _c[1];
|
|
1731
|
+
var executeFunction = _b.executeFunction;
|
|
1732
|
+
assertArray(arr, sourceCodeInfo);
|
|
1733
|
+
assertFunctionLike(fn, sourceCodeInfo);
|
|
1734
|
+
var result = [];
|
|
1735
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
1736
|
+
var subArr = arr.slice(0, i + 1);
|
|
1737
|
+
result.push(executeFunction(fn, [subArr], contextStack, sourceCodeInfo));
|
|
1738
|
+
}
|
|
1739
|
+
return result;
|
|
1740
|
+
},
|
|
1741
|
+
paramCount: 2,
|
|
1742
|
+
},
|
|
1545
1743
|
};
|
|
1546
1744
|
|
|
1547
1745
|
var sequenceNormalExpression = {
|
|
@@ -2273,7 +2471,7 @@ function isVector(vector) {
|
|
|
2273
2471
|
if (vectors.has(vector)) {
|
|
2274
2472
|
return true;
|
|
2275
2473
|
}
|
|
2276
|
-
if (vector.every(function (elem) { return isNumber(elem
|
|
2474
|
+
if (vector.every(function (elem) { return isNumber(elem); })) {
|
|
2277
2475
|
annotatedArrays.add(vector);
|
|
2278
2476
|
vectors.add(vector);
|
|
2279
2477
|
return true;
|
|
@@ -2382,7 +2580,7 @@ function isMatrix(matrix) {
|
|
|
2382
2580
|
if (row.length !== nbrOfCols) {
|
|
2383
2581
|
return false;
|
|
2384
2582
|
}
|
|
2385
|
-
if (row.some(function (cell) { return !isNumber(cell
|
|
2583
|
+
if (row.some(function (cell) { return !isNumber(cell); })) {
|
|
2386
2584
|
return false;
|
|
2387
2585
|
}
|
|
2388
2586
|
}
|
|
@@ -3915,14 +4113,6 @@ var predicatesNormalExpression = {
|
|
|
3915
4113
|
},
|
|
3916
4114
|
paramCount: 1,
|
|
3917
4115
|
},
|
|
3918
|
-
'nan?': {
|
|
3919
|
-
evaluate: function (_a, sourceCodeInfo) {
|
|
3920
|
-
var _b = __read(_a, 1), value = _b[0];
|
|
3921
|
-
assertNumber(value, sourceCodeInfo);
|
|
3922
|
-
return Number.isNaN(value);
|
|
3923
|
-
},
|
|
3924
|
-
paramCount: 1,
|
|
3925
|
-
},
|
|
3926
4116
|
'positive-infinity?': {
|
|
3927
4117
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3928
4118
|
var _b = __read(_a, 1), value = _b[0];
|
|
@@ -12484,8 +12674,13 @@ function evaluateNode(node, contextStack) {
|
|
|
12484
12674
|
return contextStack.evaluateSymbol(node);
|
|
12485
12675
|
case NodeTypes.ReservedSymbol:
|
|
12486
12676
|
return evaluateReservedSymbol(node);
|
|
12487
|
-
case NodeTypes.NormalExpression:
|
|
12488
|
-
|
|
12677
|
+
case NodeTypes.NormalExpression: {
|
|
12678
|
+
var result = evaluateNormalExpression(node, contextStack);
|
|
12679
|
+
if (typeof result === 'number' && Number.isNaN(result)) {
|
|
12680
|
+
throw new LitsError('Number is NaN', node[2]);
|
|
12681
|
+
}
|
|
12682
|
+
return annotate(result);
|
|
12683
|
+
}
|
|
12489
12684
|
case NodeTypes.SpecialExpression:
|
|
12490
12685
|
return annotate(evaluateSpecialExpression(node, contextStack));
|
|
12491
12686
|
/* v8 ignore next 2 */
|
|
@@ -12877,6 +13072,8 @@ var binaryOperators = [
|
|
|
12877
13072
|
'|>', // pipe
|
|
12878
13073
|
];
|
|
12879
13074
|
var otherOperators = [
|
|
13075
|
+
'?', // conditional operator
|
|
13076
|
+
':', // conditional operator
|
|
12880
13077
|
'->', // lambda
|
|
12881
13078
|
'...', // rest
|
|
12882
13079
|
'.', // property accessor
|
|
@@ -12886,17 +13083,12 @@ var otherOperators = [
|
|
|
12886
13083
|
];
|
|
12887
13084
|
var symbolicOperators = __spreadArray(__spreadArray([], __read(binaryOperators), false), __read(otherOperators), false);
|
|
12888
13085
|
var nonFunctionOperators = [
|
|
12889
|
-
'??',
|
|
12890
|
-
'&&',
|
|
12891
|
-
'||',
|
|
12892
13086
|
'comment',
|
|
12893
13087
|
'cond',
|
|
12894
13088
|
'def',
|
|
12895
13089
|
'defined?',
|
|
12896
|
-
// 'defn',
|
|
12897
13090
|
'do',
|
|
12898
13091
|
'doseq',
|
|
12899
|
-
// 'fn',
|
|
12900
13092
|
'if',
|
|
12901
13093
|
'let',
|
|
12902
13094
|
'loop',
|
|
@@ -13474,8 +13666,9 @@ function untokenize(tokenStream) {
|
|
|
13474
13666
|
}, '');
|
|
13475
13667
|
}
|
|
13476
13668
|
|
|
13477
|
-
var exponentiationPrecedence =
|
|
13478
|
-
var binaryFunctionalOperatorPrecedence =
|
|
13669
|
+
var exponentiationPrecedence = 12;
|
|
13670
|
+
var binaryFunctionalOperatorPrecedence = 3;
|
|
13671
|
+
var conditionalOperatorPrecedence = 1;
|
|
13479
13672
|
var placeholderRegexp = /^\$([1-9]\d?)?$/;
|
|
13480
13673
|
function withSourceCodeInfo(node, sourceCodeInfo) {
|
|
13481
13674
|
if (sourceCodeInfo) {
|
|
@@ -13490,38 +13683,39 @@ function getPrecedence(operatorSign, sourceCodeInfo) {
|
|
|
13490
13683
|
case '*': // multiplication
|
|
13491
13684
|
case '/': // division
|
|
13492
13685
|
case '%': // remainder
|
|
13493
|
-
return
|
|
13686
|
+
return 11;
|
|
13494
13687
|
case '+': // addition
|
|
13495
13688
|
case '-': // subtraction
|
|
13496
|
-
return
|
|
13689
|
+
return 10;
|
|
13497
13690
|
case '<<': // left shift
|
|
13498
13691
|
case '>>': // signed right shift
|
|
13499
13692
|
case '>>>': // unsigned right shift
|
|
13500
|
-
return
|
|
13693
|
+
return 9;
|
|
13501
13694
|
case '++': // string concatenation
|
|
13502
|
-
return
|
|
13695
|
+
return 8;
|
|
13503
13696
|
case '<': // less than
|
|
13504
13697
|
case '<=': // less than or equal
|
|
13505
13698
|
case '≤': // less than or equal
|
|
13506
13699
|
case '>': // greater than
|
|
13507
13700
|
case '>=': // greater than or equal
|
|
13508
13701
|
case '≥': // greater than or equal
|
|
13509
|
-
return
|
|
13702
|
+
return 7;
|
|
13510
13703
|
case '=': // equal
|
|
13511
13704
|
case '!=': // not equal
|
|
13512
13705
|
case '≠': // not equal
|
|
13513
|
-
return
|
|
13706
|
+
return 6;
|
|
13514
13707
|
case '&': // bitwise AND
|
|
13515
13708
|
case 'xor': // bitwise XOR
|
|
13516
13709
|
case '|': // bitwise OR
|
|
13517
|
-
return
|
|
13710
|
+
return 5;
|
|
13518
13711
|
case '&&': // logical AND
|
|
13519
13712
|
case '||': // logical OR
|
|
13520
13713
|
case '??': // nullish coalescing
|
|
13521
|
-
return
|
|
13714
|
+
return 4;
|
|
13715
|
+
// leave room for binaryFunctionalOperatorPrecedence = 3
|
|
13522
13716
|
case '|>': // pipe
|
|
13523
|
-
return
|
|
13524
|
-
// leave room for
|
|
13717
|
+
return 2;
|
|
13718
|
+
// leave room for conditionalOperatorPrecedence = 1
|
|
13525
13719
|
/* v8 ignore next 2 */
|
|
13526
13720
|
default:
|
|
13527
13721
|
throw new LitsError("Unknown binary operator: ".concat(operatorSign), sourceCodeInfo);
|
|
@@ -13569,13 +13763,15 @@ function fromBinaryOperatorToNode(operator, symbolNode, left, right, sourceCodeI
|
|
|
13569
13763
|
case '||':
|
|
13570
13764
|
case '??':
|
|
13571
13765
|
return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes[operatorName], [left, right]]], sourceCodeInfo);
|
|
13572
|
-
/* v8 ignore next
|
|
13766
|
+
/* v8 ignore next 11 */
|
|
13573
13767
|
case '.':
|
|
13574
13768
|
case ';':
|
|
13575
13769
|
case ':=':
|
|
13576
13770
|
case ',':
|
|
13577
13771
|
case '->':
|
|
13578
13772
|
case '...':
|
|
13773
|
+
case '?':
|
|
13774
|
+
case ':':
|
|
13579
13775
|
throw new LitsError("Unknown binary operator: ".concat(operatorName), sourceCodeInfo);
|
|
13580
13776
|
default:
|
|
13581
13777
|
throw new LitsError("Unknown binary operator: ".concat(operatorName), sourceCodeInfo);
|
|
@@ -13691,6 +13887,19 @@ var Parser = /** @class */ (function () {
|
|
|
13691
13887
|
}
|
|
13692
13888
|
left = createNamedNormalExpressionNode(operatorSymbol, [left, right], operator[2]);
|
|
13693
13889
|
}
|
|
13890
|
+
else if ((operator === null || operator === void 0 ? void 0 : operator[1]) === '?') {
|
|
13891
|
+
if (conditionalOperatorPrecedence <= precedence) {
|
|
13892
|
+
break;
|
|
13893
|
+
}
|
|
13894
|
+
this.advance();
|
|
13895
|
+
var trueNode = this.parseExpression();
|
|
13896
|
+
if (!isOperatorToken(this.peek(), ':')) {
|
|
13897
|
+
throw new LitsError('Expected :', this.peekSourceCodeInfo());
|
|
13898
|
+
}
|
|
13899
|
+
this.advance();
|
|
13900
|
+
var falseNode = this.parseExpression();
|
|
13901
|
+
left = withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.if, [left, trueNode, falseNode]]], left[2]);
|
|
13902
|
+
}
|
|
13694
13903
|
else {
|
|
13695
13904
|
break;
|
|
13696
13905
|
}
|