@mojir/lits 2.2.4 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/cli/cli.js +1471 -1126
- package/dist/cli/reference/api.d.ts +5 -5
- package/dist/cli/reference/index.d.ts +8 -2
- package/dist/cli/src/Lits/Lits.d.ts +8 -2
- package/dist/cli/src/builtin/bindingNode.d.ts +2 -1
- package/dist/cli/src/builtin/interface.d.ts +3 -2
- package/dist/cli/src/builtin/modules/number-theory/sequences/index.d.ts +2 -1
- package/dist/cli/src/evaluator/functionExecutors.d.ts +2 -1
- package/dist/cli/src/evaluator/index.d.ts +3 -2
- package/dist/cli/src/evaluator/interface.d.ts +3 -2
- package/dist/cli/src/tokenizer/operators.d.ts +2 -2
- package/dist/cli/src/utils/maybePromise.d.ts +54 -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/assert.esm.js +1 -1
- package/dist/modules/assert.esm.js.map +1 -1
- package/dist/modules/assert.js +1 -1
- package/dist/modules/assert.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/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/number-theory.esm.js +1 -1
- package/dist/modules/number-theory.esm.js.map +1 -1
- package/dist/modules/number-theory.js +1 -1
- package/dist/modules/number-theory.js.map +1 -1
- package/dist/modules/reference/api.d.ts +5 -5
- package/dist/modules/reference/index.d.ts +8 -2
- 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/Lits/Lits.d.ts +8 -2
- package/dist/modules/src/builtin/bindingNode.d.ts +2 -1
- package/dist/modules/src/builtin/interface.d.ts +3 -2
- package/dist/modules/src/builtin/modules/number-theory/sequences/index.d.ts +2 -1
- package/dist/modules/src/evaluator/functionExecutors.d.ts +2 -1
- package/dist/modules/src/evaluator/index.d.ts +3 -2
- package/dist/modules/src/evaluator/interface.d.ts +3 -2
- package/dist/modules/src/tokenizer/operators.d.ts +2 -2
- package/dist/modules/src/utils/maybePromise.d.ts +54 -0
- 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 +5 -5
- package/dist/reference/index.d.ts +8 -2
- package/dist/src/Lits/Lits.d.ts +8 -2
- package/dist/src/builtin/bindingNode.d.ts +2 -1
- package/dist/src/builtin/interface.d.ts +3 -2
- package/dist/src/builtin/modules/number-theory/sequences/index.d.ts +2 -1
- package/dist/src/evaluator/functionExecutors.d.ts +2 -1
- package/dist/src/evaluator/index.d.ts +3 -2
- package/dist/src/evaluator/interface.d.ts +3 -2
- package/dist/src/tokenizer/operators.d.ts +2 -2
- package/dist/src/utils/maybePromise.d.ts +54 -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 +1 -1
|
@@ -4,14 +4,14 @@ export declare const api: {
|
|
|
4
4
|
readonly collection: readonly ["filter", "map", "reduce", "count", "get", "contains?", "assoc", "++"];
|
|
5
5
|
readonly collectionUtils: readonly ["collection.filteri", "collection.mapi", "collection.reducei", "collection.reduce-right", "collection.reducei-right", "collection.reductions", "collection.reductionsi", "collection.get-in", "collection.assoc-in", "collection.update", "collection.update-in", "collection.not-empty", "collection.every?", "collection.not-every?", "collection.any?", "collection.not-any?"];
|
|
6
6
|
readonly array: readonly ["range", "repeat", "flatten", "mapcat", "moving-fn", "running-fn"];
|
|
7
|
-
readonly sequence: readonly ["nth", "push", "pop", "index-of", "some", "reverse", "first", "second", "last", "rest", "next", "sort", "slice"];
|
|
8
|
-
readonly sequenceUtils: readonly ["sequence.position", "sequence.last-index-of", "sequence.shift", "sequence.unshift", "sequence.splice", "sequence.sort-by", "sequence.
|
|
7
|
+
readonly sequence: readonly ["nth", "push", "pop", "index-of", "some", "reverse", "first", "second", "last", "rest", "next", "sort", "slice", "take", "take-last", "drop", "drop-last", "take-while", "drop-while"];
|
|
8
|
+
readonly sequenceUtils: readonly ["sequence.position", "sequence.last-index-of", "sequence.shift", "sequence.unshift", "sequence.splice", "sequence.sort-by", "sequence.distinct", "sequence.remove", "sequence.remove-at", "sequence.split-at", "sequence.split-with", "sequence.frequencies", "sequence.group-by", "sequence.partition", "sequence.partition-all", "sequence.partition-by", "sequence.starts-with?", "sequence.ends-with?", "sequence.interleave", "sequence.interpose"];
|
|
9
9
|
readonly math: readonly ["+", "-", "*", "/", "mod", "%", "quot", "inc", "dec", "sqrt", "cbrt", "^", "round", "trunc", "floor", "ceil", "min", "max", "abs", "sign"];
|
|
10
10
|
readonly mathUtils: readonly ["math.ln", "math.log2", "math.log10", "math.sin", "math.cos", "math.tan", "math.asin", "math.acos", "math.atan", "math.sinh", "math.cosh", "math.tanh", "math.asinh", "math.acosh", "math.atanh", "math.to-rad", "math.to-deg"];
|
|
11
11
|
readonly functional: readonly ["|>", "apply", "identity", "comp", "constantly"];
|
|
12
12
|
readonly functionalUtils: readonly ["functional.juxt", "functional.complement", "functional.every-pred", "functional.some-pred", "functional.fnull"];
|
|
13
13
|
readonly meta: readonly ["doc", "arity"];
|
|
14
|
-
readonly misc: readonly ["
|
|
14
|
+
readonly misc: readonly ["!=", "==", "<", ">", "<=", ">=", "not", "write!", "iso-date->epoch", "epoch->iso-date", "boolean", "compare", "identical?", "import", "json-parse", "json-stringify"];
|
|
15
15
|
readonly object: readonly ["dissoc", "keys", "vals", "entries", "find", "merge", "merge-with", "zipmap", "select-keys"];
|
|
16
16
|
readonly predicate: readonly ["boolean?", "null?", "number?", "string?", "function?", "integer?", "array?", "object?", "collection?", "sequence?", "regexp?", "zero?", "pos?", "neg?", "even?", "odd?", "finite?", "negative-infinity?", "positive-infinity?", "false?", "true?", "empty?", "not-empty?", "vector?", "grid?", "matrix?"];
|
|
17
17
|
readonly regularExpression: readonly ["regexp", "match", "replace", "replace-all"];
|
|
@@ -63,8 +63,8 @@ export type NormalExpressionName = CoreNormalExpressionName | ModuleExpressionNa
|
|
|
63
63
|
export type FunctionName = NormalExpressionName | SpecialExpressionsApiName;
|
|
64
64
|
export type ShorthandName = typeof api.shorthand[number];
|
|
65
65
|
export type DatatypeName = typeof api.datatype[number];
|
|
66
|
-
declare const coreApiNames: readonly ["filter", "map", "reduce", "count", "get", "contains?", "assoc", "++", "range", "repeat", "flatten", "mapcat", "moving-fn", "running-fn", "nth", "push", "pop", "index-of", "some", "reverse", "first", "second", "last", "rest", "next", "sort", "slice", "+", "-", "*", "/", "mod", "%", "quot", "inc", "dec", "sqrt", "cbrt", "^", "round", "trunc", "floor", "ceil", "min", "max", "abs", "sign", "|>", "apply", "identity", "comp", "constantly", "doc", "arity", "
|
|
67
|
-
declare const apiNames: readonly ["filter", "map", "reduce", "count", "get", "contains?", "assoc", "++", "range", "repeat", "flatten", "mapcat", "moving-fn", "running-fn", "nth", "push", "pop", "index-of", "some", "reverse", "first", "second", "last", "rest", "next", "sort", "slice", "+", "-", "*", "/", "mod", "%", "quot", "inc", "dec", "sqrt", "cbrt", "^", "round", "trunc", "floor", "ceil", "min", "max", "abs", "sign", "|>", "apply", "identity", "comp", "constantly", "doc", "arity", "≠", "==", "<", ">", "<=", ">=", "!", "write!", "iso-date->epoch", "epoch->iso-date", "boolean", "compare", "identical?", "import", "json-parse", "json-stringify", "dissoc", "keys", "vals", "entries", "find", "merge", "merge-with", "zipmap", "select-keys", "boolean?", "null?", "number?", "string?", "function?", "integer?", "array?", "object?", "collection?", "sequence?", "regexp?", "zero?", "pos?", "neg?", "even?", "odd?", "finite?", "negative-infinity?", "positive-infinity?", "false?", "true?", "empty?", "not-empty?", "vector?", "grid?", "matrix?", "regexp", "match", "replace", "replace-all", "str", "number", "lower-case", "upper-case", "trim", "split", "join", "blank?", "<<", ">>", ">>>", "&", "|", "xor", "sum", "mean", "median", "prod", "matrix.mul", "matrix.det", "matrix.inv", "matrix.adj", "matrix.cofactor", "matrix.minor", "matrix.trace", "matrix.symmetric?", "matrix.triangular?", "matrix.upper-triangular?", "matrix.lower-triangular?", "matrix.diagonal?", "matrix.square?", "matrix.orthogonal?", "matrix.identity?", "matrix.invertible?", "matrix.hilbert", "matrix.vandermonde", "matrix.band", "matrix.banded?", "matrix.rank", "matrix.frobenius-norm", "matrix.one-norm", "matrix.inf-norm", "matrix.max-norm", "vector.monotonic?", "vector.strictly-monotonic?", "vector.increasing?", "vector.decreasing?", "vector.strictly-increasing?", "vector.strictly-decreasing?", "vector.median", "vector.mode", "vector.min-index", "vector.max-index", "vector.sort-indices", "vector.count-values", "vector.linspace", "vector.ones", "vector.zeros", "vector.fill", "vector.generate", "vector.cumsum", "vector.cumprod", "vector.quartiles", "vector.percentile", "vector.quantile", "vector.histogram", "vector.ecdf", "vector.outliers?", "vector.outliers", "vector.bincount", "vector.winsorize", "vector.mse", "vector.mae", "vector.rmse", "vector.smape", "vector.mean", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.median", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.variance", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sample-variance", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sum", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.prod", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.stdev", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sample-stdev", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.iqr", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.span", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.geometric-mean", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.harmonic-mean", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.skewness", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sample-skewness", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.kurtosis", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sample-kurtosis", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.excess-kurtosis", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sample-excess-kurtosis", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.rms", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.mad", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.medad", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.gini-coefficient", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.entropy", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.skewness", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "linear-algebra.reflect", "linear-algebra.refract", "linear-algebra.lerp", "linear-algebra.rotate2d", "linear-algebra.rotate3d", "linear-algebra.dot", "linear-algebra.cross", "linear-algebra.normalize-minmax", "linear-algebra.normalize-zscore", "linear-algebra.normalize-robust", "linear-algebra.normalize-l1", "linear-algebra.normalize-l2", "linear-algebra.normalize-log", "linear-algebra.angle", "linear-algebra.projection", "linear-algebra.orthogonal?", "linear-algebra.parallel?", "linear-algebra.collinear?", "linear-algebra.cosine-similarity", "linear-algebra.euclidean-distance", "linear-algebra.euclidean-norm", "linear-algebra.manhattan-distance", "linear-algebra.manhattan-norm", "linear-algebra.hamming-distance", "linear-algebra.hamming-norm", "linear-algebra.chebyshev-distance", "linear-algebra.chebyshev-norm", "linear-algebra.minkowski-distance", "linear-algebra.minkowski-norm", "linear-algebra.cov", "linear-algebra.corr", "linear-algebra.spearman-corr", "linear-algebra.pearson-corr", "linear-algebra.kendall-tau", "linear-algebra.autocorrelation", "linear-algebra.cross-correlation", "linear-algebra.rref", "linear-algebra.solve", "linear-algebra.to-polar", "linear-algebra.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", "number-theory.abundant-seq", "number-theory.abundant-nth", "number-theory.abundant-take-while", "number-theory.abundant?", "number-theory.arithmetic-seq", "number-theory.arithmetic-nth", "number-theory.arithmetic-take-while", "number-theory.arithmetic?", "number-theory.bell-seq", "number-theory.bell-nth", "number-theory.bell-take-while", "number-theory.bell?", "number-theory.catalan-seq", "number-theory.catalan-nth", "number-theory.catalan-take-while", "number-theory.catalan?", "number-theory.composite-seq", "number-theory.composite-nth", "number-theory.composite-take-while", "number-theory.composite?", "number-theory.deficient-seq", "number-theory.deficient-nth", "number-theory.deficient-take-while", "number-theory.deficient?", "number-theory.factorial-seq", "number-theory.factorial-nth", "number-theory.factorial-take-while", "number-theory.factorial?", "number-theory.fibonacci-seq", "number-theory.fibonacci-nth", "number-theory.fibonacci-take-while", "number-theory.fibonacci?", "number-theory.geometric-seq", "number-theory.geometric-nth", "number-theory.geometric-take-while", "number-theory.geometric?", "number-theory.golomb-seq", "number-theory.golomb-nth", "number-theory.golomb-take-while", "number-theory.golomb?", "number-theory.happy-seq", "number-theory.happy-nth", "number-theory.happy-take-while", "number-theory.happy?", "number-theory.look-and-say-seq", "number-theory.look-and-say-nth", "number-theory.look-and-say-take-while", "number-theory.look-and-say?", "number-theory.lucas-seq", "number-theory.lucas-nth", "number-theory.lucas-take-while", "number-theory.lucas?", "number-theory.lucky-seq", "number-theory.lucky-nth", "number-theory.lucky-take-while", "number-theory.lucky?", "number-theory.mersenne-seq", "number-theory.mersenne-nth", "number-theory.mersenne-take-while", "number-theory.mersenne?", "number-theory.padovan-seq", "number-theory.padovan-nth", "number-theory.padovan-take-while", "number-theory.padovan?", "number-theory.partition-seq", "number-theory.partition-nth", "number-theory.partition-take-while", "number-theory.partition?", "number-theory.pell-seq", "number-theory.pell-nth", "number-theory.pell-take-while", "number-theory.pell?", "number-theory.perfect-seq", "number-theory.perfect-nth", "number-theory.perfect-take-while", "number-theory.perfect?", "number-theory.perfect-cube-seq", "number-theory.perfect-cube-nth", "number-theory.perfect-cube-take-while", "number-theory.perfect-cube?", "number-theory.perfect-power-seq", "number-theory.perfect-power-nth", "number-theory.perfect-power-take-while", "number-theory.perfect-power?", "number-theory.perfect-square-seq", "number-theory.perfect-square-nth", "number-theory.perfect-square-take-while", "number-theory.perfect-square?", "number-theory.polygonal-seq", "number-theory.polygonal-nth", "number-theory.polygonal-take-while", "number-theory.polygonal?", "number-theory.prime-seq", "number-theory.prime-nth", "number-theory.prime-take-while", "number-theory.prime?", "number-theory.recaman-seq", "number-theory.recaman-nth", "number-theory.recaman-take-while", "number-theory.recaman?", "number-theory.sylvester-seq", "number-theory.sylvester-nth", "number-theory.sylvester-take-while", "number-theory.sylvester?", "number-theory.thue-morse-seq", "number-theory.thue-morse-nth", "number-theory.thue-morse-take-while", "number-theory.thue-morse?", "number-theory.tribonacci-seq", "number-theory.tribonacci-nth", "number-theory.tribonacci-take-while", "number-theory.tribonacci?", "number-theory.collatz-seq", "number-theory.juggler-seq", "number-theory.bernoulli-seq", "number-theory.bernoulli-take-while", "number-theory.bernoulli-nth", "number-theory.combinations", "number-theory.count-combinations", "number-theory.derangements", "number-theory.count-derangements", "number-theory.divisors", "number-theory.count-divisors", "number-theory.proper-divisors", "number-theory.count-proper-divisors", "number-theory.prime-factors", "number-theory.count-prime-factors", "number-theory.distinct-prime-factors", "number-theory.count-distinct-prime-factors", "number-theory.factorial", "number-theory.partitions", "number-theory.count-partitions", "number-theory.permutations", "number-theory.count-permutations", "number-theory.power-set", "number-theory.count-power-set", "number-theory.coprime?", "number-theory.divisible-by?", "number-theory.gcd", "number-theory.lcm", "number-theory.multinomial", "number-theory.amicable?", "number-theory.euler-totient", "number-theory.mobius", "number-theory.mertens", "number-theory.sigma", "number-theory.carmichael-lambda", "number-theory.cartesian-product", "number-theory.perfect-power", "number-theory.mod-exp", "number-theory.mod-inv", "number-theory.extended-gcd", "number-theory.chinese-remainder", "number-theory.stirling-first", "number-theory.stirling-second", "random.random!", "random.random-int!", "random.random-int-inclusive!", "random.random-float!", "random.random-boolean!", "random.random-item!", "random.random-sample!", "random.random-sample-unique!", "random.shuffle!", "random.random-normal!", "random.random-exponential!", "random.random-binomial!", "random.random-poisson!", "random.random-gamma!", "random.random-pareto!", "random.uuid!", "random.random-char!", "random.random-string!", "random.random-id!", "random.random-color!", "math.ln", "math.log2", "math.log10", "math.sin", "math.cos", "math.tan", "math.asin", "math.acos", "math.atan", "math.sinh", "math.cosh", "math.tanh", "math.asinh", "math.acosh", "math.atanh", "math.to-rad", "math.to-deg", "functional.juxt", "functional.complement", "functional.every-pred", "functional.some-pred", "functional.fnull", "assert.assert", "assert.assert=", "assert.assert!=", "assert.assert-gt", "assert.assert-lt", "assert.assert-gte", "assert.assert-lte", "assert.assert-true", "assert.assert-false", "assert.assert-truthy", "assert.assert-falsy", "assert.assert-null", "assert.assert-throws", "assert.assert-throws-error", "assert.assert-not-throws", "assert.assert-array", "assert.assert-boolean", "assert.assert-collection", "assert.assert-function", "assert.assert-grid", "assert.assert-integer", "assert.assert-matrix", "assert.assert-number", "assert.assert-object", "assert.assert-regexp", "assert.assert-sequence", "assert.assert-string", "assert.assert-vector", "string.string-repeat", "string.from-char-code", "string.to-char-code", "string.trim-left", "string.trim-right", "string.pad-left", "string.pad-right", "string.split-lines", "string.template", "string.encode-base64", "string.decode-base64", "string.encode-uri-component", "string.decode-uri-component", "string.capitalize", "collection.filteri", "collection.mapi", "collection.reducei", "collection.reduce-right", "collection.reducei-right", "collection.reductions", "collection.reductionsi", "collection.get-in", "collection.assoc-in", "collection.update", "collection.update-in", "collection.not-empty", "collection.every?", "collection.not-every?", "collection.any?", "collection.not-any?", "sequence.position", "sequence.last-index-of", "sequence.shift", "sequence.unshift", "sequence.splice", "sequence.sort-by", "sequence.take", "sequence.take-last", "sequence.take-while", "sequence.drop", "sequence.drop-last", "sequence.drop-while", "sequence.distinct", "sequence.remove", "sequence.remove-at", "sequence.split-at", "sequence.split-with", "sequence.frequencies", "sequence.group-by", "sequence.partition", "sequence.partition-all", "sequence.partition-by", "sequence.starts-with?", "sequence.ends-with?", "sequence.interleave", "sequence.interpose", "bitwise.bit-not", "bitwise.bit-and-not", "bitwise.bit-flip", "bitwise.bit-clear", "bitwise.bit-set", "bitwise.bit-test", "-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"];
|
|
66
|
+
declare const coreApiNames: readonly ["filter", "map", "reduce", "count", "get", "contains?", "assoc", "++", "range", "repeat", "flatten", "mapcat", "moving-fn", "running-fn", "nth", "push", "pop", "index-of", "some", "reverse", "first", "second", "last", "rest", "next", "sort", "slice", "take", "take-last", "drop", "drop-last", "take-while", "drop-while", "+", "-", "*", "/", "mod", "%", "quot", "inc", "dec", "sqrt", "cbrt", "^", "round", "trunc", "floor", "ceil", "min", "max", "abs", "sign", "|>", "apply", "identity", "comp", "constantly", "doc", "arity", "!=", "==", "<", ">", "<=", ">=", "not", "write!", "iso-date->epoch", "epoch->iso-date", "boolean", "compare", "identical?", "import", "json-parse", "json-stringify", "dissoc", "keys", "vals", "entries", "find", "merge", "merge-with", "zipmap", "select-keys", "boolean?", "null?", "number?", "string?", "function?", "integer?", "array?", "object?", "collection?", "sequence?", "regexp?", "zero?", "pos?", "neg?", "even?", "odd?", "finite?", "negative-infinity?", "positive-infinity?", "false?", "true?", "empty?", "not-empty?", "vector?", "grid?", "matrix?", "regexp", "match", "replace", "replace-all", "str", "number", "lower-case", "upper-case", "trim", "split", "join", "blank?", "<<", ">>", ">>>", "&", "|", "xor", "sum", "mean", "median", "prod", "-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"];
|
|
67
|
+
declare const apiNames: readonly ["filter", "map", "reduce", "count", "get", "contains?", "assoc", "++", "range", "repeat", "flatten", "mapcat", "moving-fn", "running-fn", "nth", "push", "pop", "index-of", "some", "reverse", "first", "second", "last", "rest", "next", "sort", "slice", "take", "take-last", "drop", "drop-last", "take-while", "drop-while", "+", "-", "*", "/", "mod", "%", "quot", "inc", "dec", "sqrt", "cbrt", "^", "round", "trunc", "floor", "ceil", "min", "max", "abs", "sign", "|>", "apply", "identity", "comp", "constantly", "doc", "arity", "!=", "==", "<", ">", "<=", ">=", "not", "write!", "iso-date->epoch", "epoch->iso-date", "boolean", "compare", "identical?", "import", "json-parse", "json-stringify", "dissoc", "keys", "vals", "entries", "find", "merge", "merge-with", "zipmap", "select-keys", "boolean?", "null?", "number?", "string?", "function?", "integer?", "array?", "object?", "collection?", "sequence?", "regexp?", "zero?", "pos?", "neg?", "even?", "odd?", "finite?", "negative-infinity?", "positive-infinity?", "false?", "true?", "empty?", "not-empty?", "vector?", "grid?", "matrix?", "regexp", "match", "replace", "replace-all", "str", "number", "lower-case", "upper-case", "trim", "split", "join", "blank?", "<<", ">>", ">>>", "&", "|", "xor", "sum", "mean", "median", "prod", "matrix.mul", "matrix.det", "matrix.inv", "matrix.adj", "matrix.cofactor", "matrix.minor", "matrix.trace", "matrix.symmetric?", "matrix.triangular?", "matrix.upper-triangular?", "matrix.lower-triangular?", "matrix.diagonal?", "matrix.square?", "matrix.orthogonal?", "matrix.identity?", "matrix.invertible?", "matrix.hilbert", "matrix.vandermonde", "matrix.band", "matrix.banded?", "matrix.rank", "matrix.frobenius-norm", "matrix.one-norm", "matrix.inf-norm", "matrix.max-norm", "vector.monotonic?", "vector.strictly-monotonic?", "vector.increasing?", "vector.decreasing?", "vector.strictly-increasing?", "vector.strictly-decreasing?", "vector.median", "vector.mode", "vector.min-index", "vector.max-index", "vector.sort-indices", "vector.count-values", "vector.linspace", "vector.ones", "vector.zeros", "vector.fill", "vector.generate", "vector.cumsum", "vector.cumprod", "vector.quartiles", "vector.percentile", "vector.quantile", "vector.histogram", "vector.ecdf", "vector.outliers?", "vector.outliers", "vector.bincount", "vector.winsorize", "vector.mse", "vector.mae", "vector.rmse", "vector.smape", "vector.mean", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.median", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.variance", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sample-variance", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sum", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.prod", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.stdev", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sample-stdev", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.iqr", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.span", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.geometric-mean", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.harmonic-mean", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.skewness", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sample-skewness", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.kurtosis", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sample-kurtosis", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.excess-kurtosis", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.sample-excess-kurtosis", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.rms", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.mad", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.medad", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.gini-coefficient", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.entropy", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "vector.skewness", `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`, "linear-algebra.reflect", "linear-algebra.refract", "linear-algebra.lerp", "linear-algebra.rotate2d", "linear-algebra.rotate3d", "linear-algebra.dot", "linear-algebra.cross", "linear-algebra.normalize-minmax", "linear-algebra.normalize-zscore", "linear-algebra.normalize-robust", "linear-algebra.normalize-l1", "linear-algebra.normalize-l2", "linear-algebra.normalize-log", "linear-algebra.angle", "linear-algebra.projection", "linear-algebra.orthogonal?", "linear-algebra.parallel?", "linear-algebra.collinear?", "linear-algebra.cosine-similarity", "linear-algebra.euclidean-distance", "linear-algebra.euclidean-norm", "linear-algebra.manhattan-distance", "linear-algebra.manhattan-norm", "linear-algebra.hamming-distance", "linear-algebra.hamming-norm", "linear-algebra.chebyshev-distance", "linear-algebra.chebyshev-norm", "linear-algebra.minkowski-distance", "linear-algebra.minkowski-norm", "linear-algebra.cov", "linear-algebra.corr", "linear-algebra.spearman-corr", "linear-algebra.pearson-corr", "linear-algebra.kendall-tau", "linear-algebra.autocorrelation", "linear-algebra.cross-correlation", "linear-algebra.rref", "linear-algebra.solve", "linear-algebra.to-polar", "linear-algebra.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", "number-theory.abundant-seq", "number-theory.abundant-nth", "number-theory.abundant-take-while", "number-theory.abundant?", "number-theory.arithmetic-seq", "number-theory.arithmetic-nth", "number-theory.arithmetic-take-while", "number-theory.arithmetic?", "number-theory.bell-seq", "number-theory.bell-nth", "number-theory.bell-take-while", "number-theory.bell?", "number-theory.catalan-seq", "number-theory.catalan-nth", "number-theory.catalan-take-while", "number-theory.catalan?", "number-theory.composite-seq", "number-theory.composite-nth", "number-theory.composite-take-while", "number-theory.composite?", "number-theory.deficient-seq", "number-theory.deficient-nth", "number-theory.deficient-take-while", "number-theory.deficient?", "number-theory.factorial-seq", "number-theory.factorial-nth", "number-theory.factorial-take-while", "number-theory.factorial?", "number-theory.fibonacci-seq", "number-theory.fibonacci-nth", "number-theory.fibonacci-take-while", "number-theory.fibonacci?", "number-theory.geometric-seq", "number-theory.geometric-nth", "number-theory.geometric-take-while", "number-theory.geometric?", "number-theory.golomb-seq", "number-theory.golomb-nth", "number-theory.golomb-take-while", "number-theory.golomb?", "number-theory.happy-seq", "number-theory.happy-nth", "number-theory.happy-take-while", "number-theory.happy?", "number-theory.look-and-say-seq", "number-theory.look-and-say-nth", "number-theory.look-and-say-take-while", "number-theory.look-and-say?", "number-theory.lucas-seq", "number-theory.lucas-nth", "number-theory.lucas-take-while", "number-theory.lucas?", "number-theory.lucky-seq", "number-theory.lucky-nth", "number-theory.lucky-take-while", "number-theory.lucky?", "number-theory.mersenne-seq", "number-theory.mersenne-nth", "number-theory.mersenne-take-while", "number-theory.mersenne?", "number-theory.padovan-seq", "number-theory.padovan-nth", "number-theory.padovan-take-while", "number-theory.padovan?", "number-theory.partition-seq", "number-theory.partition-nth", "number-theory.partition-take-while", "number-theory.partition?", "number-theory.pell-seq", "number-theory.pell-nth", "number-theory.pell-take-while", "number-theory.pell?", "number-theory.perfect-seq", "number-theory.perfect-nth", "number-theory.perfect-take-while", "number-theory.perfect?", "number-theory.perfect-cube-seq", "number-theory.perfect-cube-nth", "number-theory.perfect-cube-take-while", "number-theory.perfect-cube?", "number-theory.perfect-power-seq", "number-theory.perfect-power-nth", "number-theory.perfect-power-take-while", "number-theory.perfect-power?", "number-theory.perfect-square-seq", "number-theory.perfect-square-nth", "number-theory.perfect-square-take-while", "number-theory.perfect-square?", "number-theory.polygonal-seq", "number-theory.polygonal-nth", "number-theory.polygonal-take-while", "number-theory.polygonal?", "number-theory.prime-seq", "number-theory.prime-nth", "number-theory.prime-take-while", "number-theory.prime?", "number-theory.recaman-seq", "number-theory.recaman-nth", "number-theory.recaman-take-while", "number-theory.recaman?", "number-theory.sylvester-seq", "number-theory.sylvester-nth", "number-theory.sylvester-take-while", "number-theory.sylvester?", "number-theory.thue-morse-seq", "number-theory.thue-morse-nth", "number-theory.thue-morse-take-while", "number-theory.thue-morse?", "number-theory.tribonacci-seq", "number-theory.tribonacci-nth", "number-theory.tribonacci-take-while", "number-theory.tribonacci?", "number-theory.collatz-seq", "number-theory.juggler-seq", "number-theory.bernoulli-seq", "number-theory.bernoulli-take-while", "number-theory.bernoulli-nth", "number-theory.combinations", "number-theory.count-combinations", "number-theory.derangements", "number-theory.count-derangements", "number-theory.divisors", "number-theory.count-divisors", "number-theory.proper-divisors", "number-theory.count-proper-divisors", "number-theory.prime-factors", "number-theory.count-prime-factors", "number-theory.distinct-prime-factors", "number-theory.count-distinct-prime-factors", "number-theory.factorial", "number-theory.partitions", "number-theory.count-partitions", "number-theory.permutations", "number-theory.count-permutations", "number-theory.power-set", "number-theory.count-power-set", "number-theory.coprime?", "number-theory.divisible-by?", "number-theory.gcd", "number-theory.lcm", "number-theory.multinomial", "number-theory.amicable?", "number-theory.euler-totient", "number-theory.mobius", "number-theory.mertens", "number-theory.sigma", "number-theory.carmichael-lambda", "number-theory.cartesian-product", "number-theory.perfect-power", "number-theory.mod-exp", "number-theory.mod-inv", "number-theory.extended-gcd", "number-theory.chinese-remainder", "number-theory.stirling-first", "number-theory.stirling-second", "random.random!", "random.random-int!", "random.random-int-inclusive!", "random.random-float!", "random.random-boolean!", "random.random-item!", "random.random-sample!", "random.random-sample-unique!", "random.shuffle!", "random.random-normal!", "random.random-exponential!", "random.random-binomial!", "random.random-poisson!", "random.random-gamma!", "random.random-pareto!", "random.uuid!", "random.random-char!", "random.random-string!", "random.random-id!", "random.random-color!", "math.ln", "math.log2", "math.log10", "math.sin", "math.cos", "math.tan", "math.asin", "math.acos", "math.atan", "math.sinh", "math.cosh", "math.tanh", "math.asinh", "math.acosh", "math.atanh", "math.to-rad", "math.to-deg", "functional.juxt", "functional.complement", "functional.every-pred", "functional.some-pred", "functional.fnull", "assert.assert", "assert.assert=", "assert.assert!=", "assert.assert-gt", "assert.assert-lt", "assert.assert-gte", "assert.assert-lte", "assert.assert-true", "assert.assert-false", "assert.assert-truthy", "assert.assert-falsy", "assert.assert-null", "assert.assert-throws", "assert.assert-throws-error", "assert.assert-not-throws", "assert.assert-array", "assert.assert-boolean", "assert.assert-collection", "assert.assert-function", "assert.assert-grid", "assert.assert-integer", "assert.assert-matrix", "assert.assert-number", "assert.assert-object", "assert.assert-regexp", "assert.assert-sequence", "assert.assert-string", "assert.assert-vector", "string.string-repeat", "string.from-char-code", "string.to-char-code", "string.trim-left", "string.trim-right", "string.pad-left", "string.pad-right", "string.split-lines", "string.template", "string.encode-base64", "string.decode-base64", "string.encode-uri-component", "string.decode-uri-component", "string.capitalize", "collection.filteri", "collection.mapi", "collection.reducei", "collection.reduce-right", "collection.reducei-right", "collection.reductions", "collection.reductionsi", "collection.get-in", "collection.assoc-in", "collection.update", "collection.update-in", "collection.not-empty", "collection.every?", "collection.not-every?", "collection.any?", "collection.not-any?", "sequence.position", "sequence.last-index-of", "sequence.shift", "sequence.unshift", "sequence.splice", "sequence.sort-by", "sequence.distinct", "sequence.remove", "sequence.remove-at", "sequence.split-at", "sequence.split-with", "sequence.frequencies", "sequence.group-by", "sequence.partition", "sequence.partition-all", "sequence.partition-by", "sequence.starts-with?", "sequence.ends-with?", "sequence.interleave", "sequence.interpose", "bitwise.bit-not", "bitwise.bit-and-not", "bitwise.bit-flip", "bitwise.bit-clear", "bitwise.bit-set", "bitwise.bit-test", "-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"];
|
|
68
68
|
export type CoreApiName = typeof coreApiNames[number];
|
|
69
69
|
export type ApiName = typeof apiNames[number];
|
|
70
70
|
export declare function isApiName(arg: string): arg is ApiName;
|
|
@@ -61,7 +61,7 @@ export declare const functionReference: {
|
|
|
61
61
|
">": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
62
62
|
">=": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
63
63
|
"==": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
64
|
-
"
|
|
64
|
+
"!=": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
65
65
|
"&": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
66
66
|
xor: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
67
67
|
"|": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
@@ -86,7 +86,6 @@ export declare const functionReference: {
|
|
|
86
86
|
repeat: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
87
87
|
min: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
88
88
|
max: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
89
|
-
"!": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
90
89
|
count: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
91
90
|
get: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
92
91
|
"contains?": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
@@ -103,6 +102,12 @@ export declare const functionReference: {
|
|
|
103
102
|
last: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
104
103
|
rest: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
105
104
|
next: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
105
|
+
take: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
106
|
+
"take-last": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
107
|
+
drop: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
108
|
+
"drop-last": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
109
|
+
"take-while": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
110
|
+
"drop-while": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
106
111
|
mod: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
107
112
|
quot: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
108
113
|
inc: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
@@ -121,6 +126,7 @@ export declare const functionReference: {
|
|
|
121
126
|
constantly: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
122
127
|
doc: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
123
128
|
arity: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
129
|
+
not: FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
124
130
|
"write!": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
125
131
|
"iso-date->epoch": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
126
132
|
"epoch->iso-date": FunctionReference<"string" | "object" | "array" | "special-expression" | "predicate" | "sequence" | "collection" | "math" | "functional" | "regular-expression" | "bitwise" | "misc" | "meta" | "assert" | "vector" | "linear-algebra" | "matrix" | "grid" | "number-theory" | "random" | "shorthand" | "datatype">;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e){if(!e.position||!e.code)return"";const t=e.position.column-1,s=e.code.length-t-1;return`${" ".repeat(Math.max(t,0))}^${" ".repeat(Math.max(s,0))}`}class t extends Error{sourceCodeInfo;shortMessage;constructor(s,n){const r=s instanceof Error?s.message:`${s}`;super(function(t,s){if(!s)return t;const n=`${s.position.line}:${s.position.column}`;return`${t}${s.filePath?`\n${s.filePath}:${n}`:`\nLocation ${n}`}\n${s.code}\n${e(s)}`}(r,n)),this.shortMessage=r,this.sourceCodeInfo=n,Object.setPrototypeOf(this,t.prototype),this.name="LitsError"}getCodeMarker(){return this.sourceCodeInfo&&e(this.sourceCodeInfo)}}const s={Number:1,String:2,NormalExpression:3,SpecialExpression:4,UserDefinedSymbol:5,NormalBuiltinSymbol:6,SpecialBuiltinSymbol:7,ReservedSymbol:8,Binding:9,Spread:10},n=new Set(Object.values(s));const r=new Set(["UserDefined","Partial","Comp","Constantly","Juxt","Complement","EveryPred","SomePred","Fnull","Builtin","SpecialBuiltin","NativeJsFunction","Module"]);const u="^^fn^^";function i(e){return null!==e&&"object"==typeof e&&(u in e&&"functionType"in e&&("string"==typeof(t=e.functionType)&&r.has(t)));var t}function o(e){return!(!Array.isArray(e)||e.length<2)&&("number"==typeof(t=e[0])&&n.has(t));var t}function a(e){return i(e)?`<function ${e.name||"λ"}>`:o(e)?`${t=e[0],Object.keys(s).find(e=>s[e]===t)}-node`:null===e?"null":"object"==typeof e&&e instanceof RegExp?`${e}`:"object"==typeof e&&e instanceof Error?e.toString():JSON.stringify(e);var t}function c(e,t){return e?.sourceCodeInfo??t}function p(e,s,n){return new t(`Expected ${e}, got ${a(s)}.`,c(s,n))}function l(e,t){if(!Array.isArray(e))throw p("array",e,t)}function m(e,t){if(!function(e){return Array.isArray(e)&&e.every(e=>"string"==typeof e&&1===e.length)}(e))throw p("array of strings",e,t)}function q(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function y(e){return null!==e&&"object"==typeof e&&!!e[u]}function f(e,t){return g(e,t),e}function g(e,t){if(!function(e){return void 0!==e}(e))throw p("not undefined",e,t)}function h(e){return Array.isArray(e)||"string"==typeof e}function d(e,t){return b(e,t),e}function b(e,t){if(!h(e))throw p("string or array",e,t)}function v(e){return h(e)||function(e){return!(null===e||"object"!=typeof e||Array.isArray(e)||e instanceof RegExp||y(e)||$(e))}(e)}function $(e){return null!==e&&"object"==typeof e&&!!e["^^re^^"]}function A(e,t){if(!function(e){return"number"==typeof e||!!v(e)||!!y(e)}(e))throw p("FunctionLike",e,t)}function x(e,t={}){return"number"==typeof e&&(!Number.isNaN(e)&&(!(t.integer&&!Number.isInteger(e))&&(!(t.finite&&!Number.isFinite(e))&&((!t.zero||0===e)&&((!t.nonZero||0!==e)&&(!(t.positive&&e<=0)&&(!(t.negative&&e>=0)&&(!(t.nonPositive&&e>0)&&(!(t.nonNegative&&e<0)&&(!("number"==typeof t.gt&&e<=t.gt)&&(!("number"==typeof t.gte&&e<t.gte)&&(!("number"==typeof t.lt&&e>=t.lt)&&!("number"==typeof t.lte&&e>t.lte)))))))))))))}function w(e,s,n={}){if(!x(e,n))throw new t(`Expected ${function(e){if(e.zero)return"zero";const t=function(e){return e.positive?"positive":e.negative?"negative":e.nonNegative?"non negative":e.nonPositive?"non positive":e.nonZero?"non zero":""}(e),s=e.integer?"integer":"number",n=e.finite?"finite":"",r=function(e){return"number"!=typeof e.gt&&"number"!=typeof e.gte||"number"!=typeof e.lt&&"number"!=typeof e.lte?"number"==typeof e.gt||"number"==typeof e.gte?"number"==typeof e.gt?`n > ${e.gt}`:`n >= ${e.gte}`:"number"==typeof e.lt||"number"==typeof e.lte?"number"==typeof e.lt?`n < ${e.lt}`:`n <= ${e.lte}`:"":`${"number"==typeof e.gt?`${e.gt} < n `:`${e.gte} <= n `}${"number"==typeof e.lt?`< ${e.lt}`:`<= ${e.lte}`}`}(e);return[t,n,s,r].filter(e=>!!e).join(" ")}(n)}, got ${a(e)}.`,c(e,s))}function N(e,t,s={}){return w(e,t,s),e}function j(e,t,s={}){if(!function(e,t={}){return!("string"!=typeof e||t.nonEmpty&&0===e.length||t.char&&1!==e.length)}(e,s))throw p(""+(s.nonEmpty?"non empty string":s.char?"character":"string"),e,t)}function k(e,t,s={}){return j(e,t,s),e}function M(e,t){if(!function(e){return"string"==typeof e||"number"==typeof e}(e))throw p("string or number",e,t)}function R(e,t){return!!v(e)&&("string"==typeof e||Array.isArray(e)?!!x(t,{integer:!0})&&(t>=0&&t<e.length):!!Object.getOwnPropertyDescriptor(e,t))}function I(e,s,n){if(M(e,n),M(s,n),"string"==typeof e&&"string"==typeof s)return e<s?-1:e>s?1:0;if("number"==typeof e&&"number"==typeof s)return Math.sign(e-s);throw new t(`Cannot compare values of different types: ${typeof e} and ${typeof s}`,n)}function C(e,t,s){if(e===t)return!0;if("number"==typeof e&&"number"==typeof t)return function(e,t,s=S){if(e===t)return!0;const n=Math.abs(e-t);if(0===e||0===t||n<s)return n<s;const r=Math.abs(e),u=Math.abs(t);return n/(r+u)<s}(e,t);if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!C(f(e[n],s),f(t[n],s),s))return!1;return!0}if($(e)&&$(t))return e.s===t.s&&e.f===t.f;if(q(e)&&q(t)){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r+=1){const u=k(n[r],s);if(!C(e[u],t[u],s))return!1}return!0}return!1}function E(e){return Math.max(0,Math.ceil(e))}const S=1e-10;function F(e){return{min:e,max:e}}function O(e,t,s,n,r){w(t,r,{positive:!0});const u="string"==typeof s,i=[];let o=0;e:for(;o<s.length;){const r=[];for(let u=o;u<o+e;u+=1)if(u>=s.length){const e=u-s.length;if(!n){o+=t;continue e}if(e>=n.length)break;r.push(n[e])}else r.push(s[u]);i.push(r),o+=t}return u?i.map(e=>e.join("")):i}const P={name:"sequence",functions:{position:{evaluate:([e,t],s,n,{executeFunction:r})=>{if(A(t,s),null===e)return null;if(b(e,s),"string"==typeof e){const u=e.split("").findIndex(e=>r(t,[e],n,s));return-1!==u?u:null}{const u=e.findIndex(e=>r(t,[e],n,s));return-1!==u?u:null}},arity:F(2),docs:{category:"sequence",returns:{type:["number","null"]},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:["sequence","null"]},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Returns the index of the first elements that passes the test implemented by $fun. If no element was found, `null` is returned.",seeAlso:["index-of","some","find"],examples:['\nlet su = import("sequence");\nsu.position(\n ["Albert", "Mojir", 160, [1, 2]],\n string?\n)','\nlet su = import("sequence");\nsu.position(\n [5, 10, 15, 20],\n -> $ > 10\n)','\nlet su = import("sequence");\nsu.position(\n [5, 10, 15, 20],\n -> $ > 100\n)','\nlet su = import("sequence");\nsu.position(\n null,\n -> $ > 100\n)']}},"last-index-of":{evaluate:([e,t],s)=>{if(g(t,s),null===e)return null;if(b(e,s),"string"==typeof e){j(t,s);const n=e.lastIndexOf(t);return-1!==n?n:null}{const n=e.findLastIndex(e=>C(f(e,s),t),s);return-1!==n?n:null}},arity:F(2),docs:{category:"sequence",returns:{type:["number","null"]},args:{a:{type:"sequence"},b:{type:"any"},seq:{type:["sequence","null"]},x:{type:"any"}},variants:[{argumentNames:["seq","x"]}],description:"Returns the last index of $x in $seq. If element is not present in $seq `null` is returned.",seeAlso:["index-of"],examples:['let su = import("sequence"); su.last-index-of([[1], [2], [1], [2]], [1])','let su = import("sequence"); su.last-index-of(["Albert", "Mojir", 160, [1, 2]], "Mojir")','let su = import("sequence"); su.last-index-of([5, 10, 15, 20, 15], 15)','let su = import("sequence"); su.last-index-of([5, 10, 15, 20], 1)','let su = import("sequence"); su.last-index-of(null, 1)']}},shift:{evaluate:([e],t)=>{if(b(e,t),"string"==typeof e)return e.substring(1);const s=[...e];return s.shift(),s},arity:F(1),docs:{category:"sequence",returns:{type:["sequence","null"]},args:{seq:{type:"sequence"}},variants:[{argumentNames:["seq"]}],description:"Returns a copy of $seq with first element removed. If $seq is empty `null` is returned.",seeAlso:["sequence.unshift","pop","rest"],examples:['let su = import("sequence"); su.shift([1, 2, 3])','let su = import("sequence"); su.shift([])']}},splice:{evaluate:(e,t)=>{const[s,n,r,...u]=e;b(s,t),w(n,t,{integer:!0}),w(r,t,{integer:!0,nonNegative:!0});const i=n<0?s.length+n:n;return Array.isArray(s)?[...s.slice(0,i),...u,...s.slice(i+r)]:(u.forEach(e=>j(e,t)),`${s.substring(0,i)}${u.join("")}${s.substring(i+r)}`)},arity:{min:3},docs:{category:"sequence",returns:{type:"sequence"},args:{seq:{type:"sequence",rest:!0},start:{type:"integer"},deleteCount:{type:"integer"},items:{type:"any",rest:!0}},variants:[{argumentNames:["seq","start","deleteCount"]},{argumentNames:["seq","start","deleteCount","items"]}],description:"Returns a a spliced array. Removes $deleteCount elements from $seq starting at $start and replaces them with $items. If $start is negative, it is counting from the end of the array.",seeAlso:["slice","sequence.remove-at"],examples:['let su = import("sequence"); su.splice([1, 2, 3, 4, 5], 2, 2, "x")','let su = import("sequence"); su.splice([1, 2, 3, 4, 5], -2, 1, "x")','let su = import("sequence"); su.splice("Albert", 2, 2, "fo")']}},"sort-by":{evaluate:(e,t,s,{executeFunction:n})=>{const[r,u]=e,i=2===e.length;b(r,t),A(u,t);const o=i?null:e[2];if("string"==typeof r){const e=r.split("");return i?e.sort((e,r)=>{const i=n(u,[e],s,t);M(i,t);const o=n(u,[r],s,t);return M(o,t),I(i,o,t)}):(A(o,t),e.sort((e,r)=>{const i=n(u,[e],s,t),a=n(u,[r],s,t),c=n(o,[i,a],s,t);return w(c,t,{finite:!0}),c})),e.join("")}const a=[...r];return i?a.sort((e,r)=>{const i=n(u,[e],s,t);M(i,t);const o=n(u,[r],s,t);return M(o,t),I(i,o,t)}):(A(o,t),a.sort((e,r)=>{const i=n(u,[e],s,t),a=n(u,[r],s,t),c=n(o,[i,a],s,t);return w(c,t,{finite:!0}),c})),a},arity:{min:2,max:3},docs:{category:"sequence",returns:{type:"any",rest:!0},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},keyfn:{type:"function"},comparer:{type:"function"}},variants:[{argumentNames:["seq","keyfn"]},{argumentNames:["seq","keyfn","comparer"]}],description:"Returns a sorted sequence of the items in $seq, where the sort order is determined by comparing `(keyfn item)`. If no $comparer is supplied, uses builtin `compare`.",seeAlso:["sort","compare"],examples:['let su = import("sequence"); su.sort-by(["Albert", "Mojir", "Nina"], count)','let su = import("sequence"); su.sort-by(["Albert", "Mojir", "Nina"], count)','let su = import("sequence"); su.sort-by("Albert", lower-case, -> $2 compare $1)']}},take:{evaluate:([e,t],s)=>{w(t,s),b(e,s);const n=Math.max(Math.ceil(t),0);return e.slice(0,n)},arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"integer"},n:{type:"integer"},seq:{type:"sequence"}},variants:[{argumentNames:["seq","n"]}],description:"Constructs a new array/string with the $n first elements from $seq.",seeAlso:["sequence.take-last","sequence.take-while","sequence.drop","slice","sequence.split-at"],examples:['let su = import("sequence"); su.take([1, 2, 3, 4, 5], 3)','let su = import("sequence"); su.take([1, 2, 3, 4, 5], 3)','let su = import("sequence"); su.take([1, 2, 3, 4, 5], 0)','let su = import("sequence"); su.take("Albert", 2)','let su = import("sequence"); su.take("Albert", 50)']}},"take-last":{evaluate:([e,t],s)=>{b(e,s),w(t,s);const n=Math.max(Math.ceil(t),0),r=e.length-n;return e.slice(r)},arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"integer"},n:{type:"integer"},seq:{type:"sequence"}},variants:[{argumentNames:["n","seq"]}],description:"Constructs a new array with the $n last elements from $seq.",seeAlso:["sequence.take","sequence.drop-last"],examples:['let su = import("sequence"); su.take-last([1, 2, 3, 4, 5], 3)','let su = import("sequence"); su.take-last([1, 2, 3, 4, 5], 3)','let su = import("sequence"); su.take-last([1, 2, 3, 4, 5], 0)']}},"take-while":{evaluate:([e,t],s,n,{executeFunction:r})=>{b(e,s),A(t,s);const u=[];for(const i of e){if(!r(t,[i],n,s))break;u.push(i)}return"string"==typeof e?u.join(""):u},arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Returns the members of $seq in order, stopping before the first one for which `predicate` returns a falsy value.",seeAlso:["sequence.take","sequence.drop-while","sequence.split-with"],examples:['\nlet su = import("sequence");\nsu.take-while(\n [1, 2, 3, 2, 1],\n -> $ < 3\n)','\nlet su = import("sequence");\nsu.take-while(\n [1, 2, 3, 2, 1],\n -> $ > 3\n)']}},drop:{evaluate:([e,t],s)=>{w(t,s);const n=Math.max(Math.ceil(t),0);return b(e,s),e.slice(n)},arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"integer"},seq:{type:"sequence"},n:{type:"integer"}},variants:[{argumentNames:["seq","n"]}],description:"Constructs a new array/string with the $n first elements dropped from $seq.",seeAlso:["sequence.drop-last","sequence.drop-while","sequence.take","slice","sequence.split-at"],examples:['let su = import("sequence"); su.drop([1, 2, 3, 4, 5], 3)','let su = import("sequence"); su.drop([1, 2, 3, 4, 5], 0)','let su = import("sequence"); su.drop("Albert", 2)','let su = import("sequence"); su.drop("Albert", 50)']}},"drop-last":{evaluate:([e,t],s)=>{b(e,s),w(t,s);const n=Math.max(Math.ceil(t),0),r=e.length-n;return e.slice(0,r)},arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"integer"},seq:{type:"sequence"},n:{type:"integer"}},variants:[{argumentNames:["seq","n"]}],description:"Constructs a new array with the $n last elements dropped from $seq.",seeAlso:["sequence.drop","sequence.take-last"],examples:['let su = import("sequence"); su.drop-last([1, 2, 3, 4, 5], 3)','let su = import("sequence"); su.drop-last([1, 2, 3, 4, 5], 3)','let su = import("sequence"); su.drop-last([1, 2, 3, 4, 5], 0)']}},"drop-while":{evaluate:([e,t],s,n,{executeFunction:r})=>{if(b(e,s),A(t,s),Array.isArray(e)){const u=e.findIndex(e=>!r(t,[e],n,s));return e.slice(u)}const u=e.split(""),i=u.findIndex(e=>!r(t,[e],n,s));return u.slice(i).join("")},arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Returns the members of $seq in order, skipping the fist elements for witch the `predicate` returns a truethy value.",seeAlso:["sequence.drop","sequence.take-while","sequence.split-with"],examples:['\nlet su = import("sequence");\nsu.drop-while(\n [1, 2, 3, 2, 1],\n -> $ < 3\n)','\nlet su = import("sequence");\nsu.drop-while(\n [1, 2, 3, 2, 1],\n -> $ > 3\n)']}},unshift:{evaluate:([e,...t],s)=>{if(b(e,s),"string"==typeof e)return m(t,s),[...t,e].join("");const n=[...e];return n.unshift(...t),n},arity:{min:2},docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"any"},seq:{type:"sequence"},values:{type:"any",rest:!0}},variants:[{argumentNames:["seq","values"]}],description:"Returns copy of $seq with $values added to the beginning.",seeAlso:["push","sequence.shift","++"],examples:['let su = import("sequence"); su.unshift([1, 2, 3], 4)','let su = import("sequence"); su.unshift([1, 2, 3], 4)','let su = import("sequence"); su.unshift([1, 2, 3], 4, 5, 6)','\nlet su = import("sequence");\nlet l = [1, 2, 3];\nsu.unshift(l, 4);\nl']}},distinct:{evaluate:([e],t)=>{if(b(e,t),Array.isArray(e)){const s=[];for(const n of e)g(n,t),s.some(e=>C(e,n,t))||s.push(n);return s}return Array.from(new Set(e.split(""))).join("")},arity:F(1),docs:{category:"sequence",returns:{type:"sequence"},args:{seq:{type:"sequence"}},variants:[{argumentNames:["seq"]}],description:"Returns a copy of $seq with no duplicates.",seeAlso:["sequence.frequencies"],examples:['let su = import("sequence"); su.distinct([[1], [2], [3], [1], [3], [5]])','let su = import("sequence"); su.distinct([1, 2, 3, 1, 3, 5])','let su = import("sequence"); su.distinct("Albert Mojir")','let su = import("sequence"); su.distinct([])','let su = import("sequence"); su.distinct("")']}},remove:{evaluate:([e,t],s,n,{executeFunction:r})=>(A(t,s),b(e,s),Array.isArray(e)?e.filter(e=>!r(t,[e],n,s)):e.split("").filter(e=>!r(t,[e],n,s)).join("")),arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Returns a new sequence of items in $seq for witch `pred(item)` returns a falsy value.",seeAlso:["filter","sequence.remove-at"],examples:['let su = import("sequence"); su.remove([1, 2, 3, 1, 3, 5], odd?)','let su = import("sequence"); su.remove([1, 2, 3, 1, 3, 5], even?)','let su = import("sequence"); su.remove("Albert Mojir", -> "aoueiyAOUEIY" contains? $)']}},"remove-at":{evaluate:([e,t],s)=>{w(t,s,{integer:!0}),b(e,s);const n=t<0?e.length+t:t;return n<0||n>=e.length?e:Array.isArray(e)?e.filter((e,t)=>t!==n):`${e.substring(0,n)}${e.substring(n+1)}`},arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"integer"},seq:{type:"sequence"},n:{type:"number"}},variants:[{argumentNames:["seq","n"]}],description:"Returns a new sequence of all items in $seq except item at position $n. If $n is negative, it is counting from the end of the sequence.",seeAlso:["sequence.remove","sequence.splice"],examples:['let su = import("sequence"); su.remove-at([1, 2, 3, 1, 3, 5], 2)','let su = import("sequence"); su.remove-at("Albert", -2)','let su = import("sequence"); su.remove-at([1, 2, 3, 1, 3, 5], 0)','let su = import("sequence"); su.remove-at([1, 2, 3, 1, 3, 5], -1)','let su = import("sequence"); su.remove-at("Albert Mojir", 6)']}},"split-at":{evaluate:([e,t],s)=>{w(t,s,{integer:!0}),b(e,s);const n=t<0?e.length+t:t;return[e.slice(0,n),e.slice(n)]},arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"integer"},seq:{type:"sequence"},n:{type:"number"}},variants:[{argumentNames:["seq","n"]}],description:"Returns a pair of sequence `[take(pos input), drop(pos input)]`.",seeAlso:["sequence.split-with","sequence.take","sequence.drop"],examples:['let su = import("sequence"); su.split-at([1, 2, 3, 4, 5], 2)','let su = import("sequence"); su.split-at("Albert", -2)','let su = import("sequence"); su.split-at([1, 2, 3, 4, 5], -2)','let su = import("sequence"); su.split-at("Albert", 2)']}},"split-with":{evaluate:([e,t],s,n,{executeFunction:r})=>{A(t,s),b(e,s);const u=Array.isArray(e),i=(u?e:e.split("")).findIndex(e=>!r(t,[e],n,s));return-1===i?[e,u?[]:""]:[e.slice(0,i),e.slice(i)]},arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Returns a pair of sequences `[take-while(input, fun), drop-while(input, fun)]`.",seeAlso:["sequence.split-at","sequence.take-while","sequence.drop-while"],examples:['let su = import("sequence"); su.split-with([1, 2, 3, 4, 5], odd?)','let su = import("sequence"); su.split-with([1, 2, 3, 4, 5], -> $ > 3)','let su = import("sequence"); su.split-with("Albert", -> $ <= "o")']}},frequencies:{evaluate:([e],t)=>{b(e,t);return("string"==typeof e?e.split(""):e).reduce((e,s)=>(j(s,t),R(e,s)?e[s]=e[s]+1:e[s]=1,e),{})},arity:F(1),docs:{category:"sequence",returns:{type:"object"},args:{seq:{type:"sequence"}},variants:[{argumentNames:["seq"]}],description:"Returns an object from distinct items in $seq to the number of times they appear. Note that all items in $seq must be valid object keys i.e. strings.",seeAlso:["sequence.group-by","sequence.distinct","vector.count-values"],examples:['let su = import("sequence"); su.frequencies(["Albert", "Mojir", "Nina", "Mojir"])','let su = import("sequence"); su.frequencies("Pneumonoultramicroscopicsilicovolcanoconiosis")']}},"group-by":{evaluate:([e,t],s,n,{executeFunction:r})=>{A(t,s),b(e,s);return(Array.isArray(e)?e:e.split("")).reduce((e,u)=>{const i=r(t,[u],n,s);return j(i,s),R(e,i)||(e[i]=[]),e[i].push(u),e},{})},arity:F(2),docs:{category:"sequence",returns:{type:"object"},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Returns an object of the elements of $seq keyed by the result of $fun on each element. The value at each key will be an array of the corresponding elements.",seeAlso:["sequence.frequencies","sequence.partition-by"],examples:['let su = import("sequence"); su.group-by([{ name: "Albert" }, { name: "Albert" }, { name: "Mojir" }], "name")','let su = import("sequence"); su.group-by([{name: "Albert"}, {name: "Albert"}, {name: "Mojir"}], "name")','let su = import("sequence"); su.group-by("Albert Mojir", -> "aoueiAOUEI" contains? $ ? "vowel" : "other")']}},partition:{evaluate:(e,t)=>{const s=d(e[0],t),n=E(N(e[1],t)),r=e.length>=3?E(N(e[2],t)):n,u=4===e.length?null===e[3]?[]:function(e,t){return l(e,t),e}(e[3],t):void 0;return O(n,r,s,u,t)},arity:{min:2,max:4},docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"number"},seq:{type:"sequence"},n:{type:"number"},step:{type:"number"},pad:{type:"array"}},variants:[{argumentNames:["seq","n"]},{argumentNames:["seq","n","step"]},{argumentNames:["seq","n","step","pad"]}],description:"Returns an array of sequences of $n items each, at offsets $step apart. If $step is not supplied, defaults to $n. If a $pad array is supplied, use its elements as necessary to complete last partition upto $n items. In case there are not enough padding elements, return a partition with less than $n items.",seeAlso:["sequence.partition-all","sequence.partition-by"],examples:['let su = import("sequence"); su.partition(range(20), 4)','let su = import("sequence"); su.partition(range(20), 4)','let su = import("sequence"); su.partition(range(22), 4)','let su = import("sequence"); su.partition(range(20), 4, 6)','let su = import("sequence"); su.partition(range(20), 4, 3)','let su = import("sequence"); su.partition(range(20), 3, 6, ["a"])','let su = import("sequence"); su.partition(range(20), 4, 6, ["a"])','let su = import("sequence"); su.partition(range(20), 4, 6, ["a", "b", "c", "d"])','let su = import("sequence"); su.partition(["a", "b", "c", "d", "e", "f"], 3, 1)','let su = import("sequence"); su.partition([1, 2, 3, 4], 10)','let su = import("sequence"); su.partition([1, 2, 3, 4], 10, 10)','let su = import("sequence"); su.partition([1, 2, 3, 4], 10, 10, [])','let su = import("sequence"); su.partition([1, 2, 3, 4], 10, 10, null)','let su = import("sequence"); su.partition("superfragilistic", 5)','let su = import("sequence"); su.partition("superfragilistic", 5, 5, null)','let su = import("sequence"); let foo = [5, 6, 7, 8]; su.partition(foo, 2, 1, foo)']}},"partition-all":{evaluate:(e,t)=>{const s=d(e[0],t),n=E(N(e[1],t));return O(n,3===e.length?E(N(e[2],t)):n,s,[],t)},arity:{min:2,max:3},docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"number"},seq:{type:"sequence"},n:{type:"number"},step:{type:"number"}},variants:[{argumentNames:["seq","n"]},{argumentNames:["seq","n","step"]}],description:"Returns an array of sequences like partition, but may include partitions with fewer than n items at the end.",seeAlso:["sequence.partition","sequence.partition-by"],examples:['let su = import("sequence"); su.partition-all([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)','let su = import("sequence"); su.partition-all([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)','let su = import("sequence"); su.partition([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)','let su = import("sequence"); su.partition-all([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 2, 4)']}},"partition-by":{evaluate:([e,t],s,n,{executeFunction:r})=>{A(t,s),b(e,s);const u="string"==typeof e;let i;const o=(u?e.split(""):e).reduce((e,u)=>{const o=r(t,[u],n,s);return o!==i&&(e.push([]),i=o),e[e.length-1].push(u),e},[]);return u?o.map(e=>e.join("")):o},arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Applies $fun to each value in $seq, splitting it each time $fun returns a new value. Returns an array of sequences.",seeAlso:["sequence.partition","sequence.partition-all","sequence.group-by"],examples:['let su = import("sequence"); su.partition-by([1, 2, 3, 4, 5], odd?)','let su = import("sequence"); su.partition-by([1, 2, 3, 4, 5], -> $ == 3)','let su = import("sequence"); su.partition-by([1, 1, 1, 2, 2, 3, 3], odd?)','let su = import("sequence"); su.partition-by("Leeeeeerrroyyy", identity)']}},"ends-with?":{evaluate:([e,t],s)=>(b(e,s),"string"==typeof e?(j(t,s),e.endsWith(t)):C(f(e.at(-1),s),f(t,s),s)),arity:F(2),docs:{category:"sequence",returns:{type:"boolean"},args:{a:{type:"sequence"},b:{type:"sequence"},seq:{type:"sequence"},suffix:{type:"sequence"}},variants:[{argumentNames:["seq","suffix"]}],description:"Returns `true` if $seq ends with $suffix, otherwise `false`.",seeAlso:["sequence.starts-with?"],examples:['let su = import("sequence"); su.ends-with?([[1], [2], [3], [4], [5]], [5])','let su = import("sequence"); su.ends-with?([[1], [2], [3], [4], [5]], 5)','let su = import("sequence"); su.ends-with?([1, 2, 3, 4, 5], 5)','let su = import("sequence"); su.ends-with?([1, 2, 3, 4, 5], [5])','let su = import("sequence"); su.ends-with?("Albert", "rt")','let su = import("sequence"); su.ends-with?("Albert", "RT")']}},"starts-with?":{evaluate:([e,t],s)=>(b(e,s),"string"==typeof e?(j(t,s),e.startsWith(t)):C(f(e[0],s),f(t,s),s)),arity:F(2),docs:{category:"sequence",returns:{type:"boolean"},args:{a:{type:"sequence"},b:{type:"sequence"},seq:{type:"sequence"},prefix:{type:"sequence"}},variants:[{argumentNames:["seq","prefix"]}],description:"Returns `true` if $seq starts with $prefix, otherwise `false`.",seeAlso:["sequence.ends-with?"],examples:['let su = import("sequence"); su.starts-with?([[1], [2], [3], [4], [5]], [1])','let su = import("sequence"); su.starts-with?([1, 2, 3, 4, 5], 1)','let su = import("sequence"); su.starts-with?([1, 2, 3, 4, 5], [1])','let su = import("sequence"); su.starts-with?("Albert", "Al")','let su = import("sequence"); su.starts-with?("Albert", "al")']}},interleave:{evaluate:([...e],t)=>{const s="string"==typeof e[0],n=s?e.map(e=>(j(e,t),e.split(""))):e.map(e=>(l(e,t),e)),r=Math.min(...n.map(e=>e.length)),u=[];for(let e=0;e<r;e+=1)for(const t of n)e<t.length&&u.push(t[e]);return s?u.join(""):u},arity:{min:1},docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"sequence"},seqs:{type:"sequence",rest:!0}},variants:[{argumentNames:["seqs"]}],description:"Returns a sequence of the first item from each of the $seqs, then the second item from each of the $seqs, until all items from the shortest seq are exhausted.",seeAlso:["sequence.interpose","zipmap"],examples:['let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6])','let su = import("sequence"); su.interleave("Albert", ".,.,.,")','let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6])','let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6], [7, 8, 9])','let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6], [7, 8])','let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6], [7])','let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6], [])','let su = import("sequence"); su.interleave([1, 2, 3], [])','let su = import("sequence"); su.interleave([])']}},interpose:{evaluate:([e,t],s)=>{if(b(e,s),"string"==typeof e)return j(t,s),e.split("").join(t);if(0===e.length)return[];const n=[];for(let s=0;s<e.length-1;s+=1)n.push(e[s],t);return n.push(e[e.length-1]),n},arity:F(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"any"},seq:{type:"sequence"},separator:{type:"any"}},variants:[{argumentNames:["seq","separator"]}],description:"Returns a sequence of the elements of $seq separated by $separator. If $seq is a string, the separator must be a string.",seeAlso:["sequence.interleave","join"],examples:['let su = import("sequence"); su.interpose("Albert", "-")','let su = import("sequence"); su.interpose([1, 2, 3, 4, 5], "a")','let su = import("sequence"); su.interpose(["Albert", "Mojir", "Nina"], ", ")','let su = import("sequence"); su.interpose("Albert", ".")']}}}};export{P as sequenceUtilsModule};
|
|
1
|
+
function e(e){if(!e.position||!e.code)return"";const t=e.position.column-1,n=e.code.length-t-1;return`${" ".repeat(Math.max(t,0))}^${" ".repeat(Math.max(n,0))}`}class t extends Error{sourceCodeInfo;shortMessage;constructor(n,s){const r=n instanceof Error?n.message:`${n}`;super(function(t,n){if(!n)return t;const s=`${n.position.line}:${n.position.column}`;return`${t}${n.filePath?`\n${n.filePath}:${s}`:`\nLocation ${s}`}\n${n.code}\n${e(n)}`}(r,s)),this.shortMessage=r,this.sourceCodeInfo=s,Object.setPrototypeOf(this,t.prototype),this.name="LitsError"}getCodeMarker(){return this.sourceCodeInfo&&e(this.sourceCodeInfo)}}const n={Number:1,String:2,NormalExpression:3,SpecialExpression:4,UserDefinedSymbol:5,NormalBuiltinSymbol:6,SpecialBuiltinSymbol:7,ReservedSymbol:8,Binding:9,Spread:10},s=new Set(Object.values(n));const r=new Set(["UserDefined","Partial","Comp","Constantly","Juxt","Complement","EveryPred","SomePred","Fnull","Builtin","SpecialBuiltin","NativeJsFunction","Module"]);const u="^^fn^^";function i(e){return null!==e&&"object"==typeof e&&(u in e&&"functionType"in e&&("string"==typeof(t=e.functionType)&&r.has(t)));var t}function o(e){return!(!Array.isArray(e)||e.length<2)&&("number"==typeof(t=e[0])&&s.has(t));var t}function a(e){return i(e)?`<function ${e.name||"λ"}>`:o(e)?`${t=e[0],Object.keys(n).find(e=>n[e]===t)}-node`:null===e?"null":"object"==typeof e&&e instanceof RegExp?`${e}`:"object"==typeof e&&e instanceof Error?e.toString():JSON.stringify(e);var t}function c(e,t){return e?.sourceCodeInfo??t}function p(e,n,s){return new t(`Expected ${e}, got ${a(n)}.`,c(n,s))}function l(e,t){if(!Array.isArray(e))throw p("array",e,t)}function f(e,t){if(!function(e){return Array.isArray(e)&&e.every(e=>"string"==typeof e&&1===e.length)}(e))throw p("array of strings",e,t)}function m(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function y(e){return null!==e&&"object"==typeof e&&!!e[u]}function q(e,t){return g(e,t),e}function g(e,t){if(!function(e){return void 0!==e}(e))throw p("not undefined",e,t)}function h(e){return Array.isArray(e)||"string"==typeof e}function d(e,t){return b(e,t),e}function b(e,t){if(!h(e))throw p("string or array",e,t)}function v(e){return h(e)||function(e){return!(null===e||"object"!=typeof e||Array.isArray(e)||e instanceof RegExp||y(e)||$(e))}(e)}function $(e){return null!==e&&"object"==typeof e&&!!e["^^re^^"]}function A(e,t){if(!function(e){return"number"==typeof e||!!v(e)||!!y(e)}(e))throw p("FunctionLike",e,t)}function w(e,t={}){return"number"==typeof e&&(!Number.isNaN(e)&&(!(t.integer&&!Number.isInteger(e))&&(!(t.finite&&!Number.isFinite(e))&&((!t.zero||0===e)&&((!t.nonZero||0!==e)&&(!(t.positive&&e<=0)&&(!(t.negative&&e>=0)&&(!(t.nonPositive&&e>0)&&(!(t.nonNegative&&e<0)&&(!("number"==typeof t.gt&&e<=t.gt)&&(!("number"==typeof t.gte&&e<t.gte)&&(!("number"==typeof t.lt&&e>=t.lt)&&!("number"==typeof t.lte&&e>t.lte)))))))))))))}function x(e,n,s={}){if(!w(e,s))throw new t(`Expected ${function(e){if(e.zero)return"zero";const t=function(e){return e.positive?"positive":e.negative?"negative":e.nonNegative?"non negative":e.nonPositive?"non positive":e.nonZero?"non zero":""}(e),n=e.integer?"integer":"number",s=e.finite?"finite":"",r=function(e){return"number"!=typeof e.gt&&"number"!=typeof e.gte||"number"!=typeof e.lt&&"number"!=typeof e.lte?"number"==typeof e.gt||"number"==typeof e.gte?"number"==typeof e.gt?`n > ${e.gt}`:`n >= ${e.gte}`:"number"==typeof e.lt||"number"==typeof e.lte?"number"==typeof e.lt?`n < ${e.lt}`:`n <= ${e.lte}`:"":`${"number"==typeof e.gt?`${e.gt} < n `:`${e.gte} <= n `}${"number"==typeof e.lt?`< ${e.lt}`:`<= ${e.lte}`}`}(e);return[t,s,n,r].filter(e=>!!e).join(" ")}(s)}, got ${a(e)}.`,c(e,n))}function j(e,t,n={}){return x(e,t,n),e}function N(e,t,n={}){if(!function(e,t={}){return!("string"!=typeof e||t.nonEmpty&&0===e.length||t.char&&1!==e.length)}(e,n))throw p(""+(n.nonEmpty?"non empty string":n.char?"character":"string"),e,t)}function M(e,t,n={}){return N(e,t,n),e}function k(e,t){if(!function(e){return"string"==typeof e||"number"==typeof e}(e))throw p("string or number",e,t)}function R(e,t){return!!v(e)&&("string"==typeof e||Array.isArray(e)?!!w(t,{integer:!0})&&(t>=0&&t<e.length):!!Object.getOwnPropertyDescriptor(e,t))}function I(e,t,n){if(e===t)return!0;if("number"==typeof e&&"number"==typeof t)return function(e,t,n=P){if(e===t)return!0;const s=Math.abs(e-t);if(0===e||0===t||s<n)return s<n;const r=Math.abs(e),u=Math.abs(t);return s/(r+u)<n}(e,t);if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(!I(q(e[s],n),q(t[s],n),n))return!1;return!0}if($(e)&&$(t))return e.s===t.s&&e.f===t.f;if(m(e)&&m(t)){const s=Object.keys(e),r=Object.keys(t);if(s.length!==r.length)return!1;for(let r=0;r<s.length;r+=1){const u=M(s[r],n);if(!I(e[u],t[u],n))return!1}return!0}return!1}function E(e){return Math.max(0,Math.ceil(e))}const P=1e-10;function S(e){return{min:e,max:e}}function C(e,t){return e instanceof Promise?e.then(t):t(e)}async function O(e,t,n,s,r){t.push(await e);for(let e=r+1;e<n.length;e++)t.push(await s(n[e],e));return t}function F(e,t,n){let s=n;for(let n=0;n<e.length;n++){const r=t(s,e[n],n);if(r instanceof Promise)return z(r,e,t,n);s=r}return s}async function z(e,t,n,s){let r=await e;for(let e=s+1;e<t.length;e++)r=await n(r,t[e],e);return r}async function B(e,t,n,s,r){await e&&t.push(n[r]);for(let e=r+1;e<n.length;e++)await s(n[e],e)&&t.push(n[e]);return t}function L(e,t){for(let n=0;n<e.length;n++){const s=t(e[n],n);if(s instanceof Promise)return T(s,e,t,n);if(s)return n}return-1}async function T(e,t,n,s){if(await e)return s;for(let e=s+1;e<t.length;e++)if(await n(t[e],e))return e;return-1}const U={position:{evaluate:([e,t],n,s,{executeFunction:r})=>{if(A(t,n),null===e)return null;b(e,n);return C(L("string"==typeof e?e.split(""):e,e=>r(t,[e],s,n)),e=>-1!==e?e:null)},arity:S(2),docs:{category:"sequence",returns:{type:["number","null"]},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:["sequence","null"]},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Returns the index of the first elements that passes the test implemented by $fun. If no element was found, `null` is returned.",seeAlso:["index-of","some","find"],examples:['\nlet su = import("sequence");\nsu.position(\n ["Albert", "Mojir", 160, [1, 2]],\n string?\n)','\nlet su = import("sequence");\nsu.position(\n [5, 10, 15, 20],\n -> $ > 10\n)','\nlet su = import("sequence");\nsu.position(\n [5, 10, 15, 20],\n -> $ > 100\n)','\nlet su = import("sequence");\nsu.position(\n null,\n -> $ > 100\n)']}},"last-index-of":{evaluate:([e,t],n)=>{if(g(t,n),null===e)return null;if(b(e,n),"string"==typeof e){N(t,n);const s=e.lastIndexOf(t);return-1!==s?s:null}{const s=e.findLastIndex(e=>I(q(e,n),t),n);return-1!==s?s:null}},arity:S(2),docs:{category:"sequence",returns:{type:["number","null"]},args:{a:{type:"sequence"},b:{type:"any"},seq:{type:["sequence","null"]},x:{type:"any"}},variants:[{argumentNames:["seq","x"]}],description:"Returns the last index of $x in $seq. If element is not present in $seq `null` is returned.",seeAlso:["index-of"],examples:['let su = import("sequence"); su.last-index-of([[1], [2], [1], [2]], [1])','let su = import("sequence"); su.last-index-of(["Albert", "Mojir", 160, [1, 2]], "Mojir")','let su = import("sequence"); su.last-index-of([5, 10, 15, 20, 15], 15)','let su = import("sequence"); su.last-index-of([5, 10, 15, 20], 1)','let su = import("sequence"); su.last-index-of(null, 1)']}},shift:{evaluate:([e],t)=>{if(b(e,t),"string"==typeof e)return e.substring(1);const n=[...e];return n.shift(),n},arity:S(1),docs:{category:"sequence",returns:{type:["sequence","null"]},args:{seq:{type:"sequence"}},variants:[{argumentNames:["seq"]}],description:"Returns a copy of $seq with first element removed. If $seq is empty `null` is returned.",seeAlso:["sequence.unshift","pop","rest"],examples:['let su = import("sequence"); su.shift([1, 2, 3])','let su = import("sequence"); su.shift([])']}},splice:{evaluate:(e,t)=>{const[n,s,r,...u]=e;b(n,t),x(s,t,{integer:!0}),x(r,t,{integer:!0,nonNegative:!0});const i=s<0?n.length+s:s;return Array.isArray(n)?[...n.slice(0,i),...u,...n.slice(i+r)]:(u.forEach(e=>N(e,t)),`${n.substring(0,i)}${u.join("")}${n.substring(i+r)}`)},arity:{min:3},docs:{category:"sequence",returns:{type:"sequence"},args:{seq:{type:"sequence",rest:!0},start:{type:"integer"},deleteCount:{type:"integer"},items:{type:"any",rest:!0}},variants:[{argumentNames:["seq","start","deleteCount"]},{argumentNames:["seq","start","deleteCount","items"]}],description:"Returns a a spliced array. Removes $deleteCount elements from $seq starting at $start and replaces them with $items. If $start is negative, it is counting from the end of the array.",seeAlso:["slice","sequence.remove-at"],examples:['let su = import("sequence"); su.splice([1, 2, 3, 4, 5], 2, 2, "x")','let su = import("sequence"); su.splice([1, 2, 3, 4, 5], -2, 1, "x")','let su = import("sequence"); su.splice("Albert", 2, 2, "fo")']}},"sort-by":{evaluate:(e,n,s,{executeFunction:r})=>{const[u,i]=e,o=2===e.length;b(u,n),A(i,n);const a=o?null:e[2],c="string"==typeof u,p=c?u.split(""):[...u];return C(function(e,t){const n=[];for(let s=0;s<e.length;s++){const r=t(e[s],s);if(r instanceof Promise)return O(r,n,e,t,s);n.push(r)}return n}(p,e=>r(i,[e],s,n)),e=>{if(o){const s=p.map((t,n)=>({elem:t,key:e[n]}));s.sort((e,s)=>(k(e.key,n),k(s.key,n),function(e,n,s){if(k(e,s),k(n,s),"string"==typeof e&&"string"==typeof n)return e<n?-1:e>n?1:0;if("number"==typeof e&&"number"==typeof n)return Math.sign(e-n);throw new t(`Cannot compare values of different types: ${typeof e} and ${typeof n}`,s)}(e.key,s.key,n)));const r=s.map(e=>e.elem);return c?r.join(""):r}{A(a,n);const t=p.map((t,n)=>({elem:t,key:e[n]}));t.sort((e,t)=>{const u=r(a,[e.key,t.key],s,n);if(u instanceof Promise)throw new TypeError("Async functions cannot be used as sort-by comparators");return x(u,n,{finite:!0}),u});const u=t.map(e=>e.elem);return c?u.join(""):u}})},arity:{min:2,max:3},docs:{category:"sequence",returns:{type:"any",rest:!0},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},keyfn:{type:"function"},comparer:{type:"function"}},variants:[{argumentNames:["seq","keyfn"]},{argumentNames:["seq","keyfn","comparer"]}],description:"Returns a sorted sequence of the items in $seq, where the sort order is determined by comparing `(keyfn item)`. If no $comparer is supplied, uses builtin `compare`.",seeAlso:["sort","compare"],examples:['let su = import("sequence"); su.sort-by(["Albert", "Mojir", "Nina"], count)','let su = import("sequence"); su.sort-by(["Albert", "Mojir", "Nina"], count)','let su = import("sequence"); su.sort-by("Albert", lower-case, -> $2 compare $1)']}},unshift:{evaluate:([e,...t],n)=>{if(b(e,n),"string"==typeof e)return f(t,n),[...t,e].join("");const s=[...e];return s.unshift(...t),s},arity:{min:2},docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"any"},seq:{type:"sequence"},values:{type:"any",rest:!0}},variants:[{argumentNames:["seq","values"]}],description:"Returns copy of $seq with $values added to the beginning.",seeAlso:["push","sequence.shift","++"],examples:['let su = import("sequence"); su.unshift([1, 2, 3], 4)','let su = import("sequence"); su.unshift([1, 2, 3], 4)','let su = import("sequence"); su.unshift([1, 2, 3], 4, 5, 6)','\nlet su = import("sequence");\nlet l = [1, 2, 3];\nsu.unshift(l, 4);\nl']}},distinct:{evaluate:([e],t)=>{if(b(e,t),Array.isArray(e)){const n=[];for(const s of e)g(s,t),n.some(e=>I(e,s,t))||n.push(s);return n}return Array.from(new Set(e.split(""))).join("")},arity:S(1),docs:{category:"sequence",returns:{type:"sequence"},args:{seq:{type:"sequence"}},variants:[{argumentNames:["seq"]}],description:"Returns a copy of $seq with no duplicates.",seeAlso:["sequence.frequencies"],examples:['let su = import("sequence"); su.distinct([[1], [2], [3], [1], [3], [5]])','let su = import("sequence"); su.distinct([1, 2, 3, 1, 3, 5])','let su = import("sequence"); su.distinct("Albert Mojir")','let su = import("sequence"); su.distinct([])','let su = import("sequence"); su.distinct("")']}},remove:{evaluate:([e,t],n,s,{executeFunction:r})=>{A(t,n),b(e,n);return C(function(e,t){const n=[];for(let s=0;s<e.length;s++){const r=t(e[s],s);if(r instanceof Promise)return B(r,n,e,t,s);r&&n.push(e[s])}return n}(Array.isArray(e)?e:e.split(""),e=>C(r(t,[e],s,n),e=>!e)),t=>"string"==typeof e?t.join(""):t)},arity:S(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Returns a new sequence of items in $seq for witch `pred(item)` returns a falsy value.",seeAlso:["filter","sequence.remove-at"],examples:['let su = import("sequence"); su.remove([1, 2, 3, 1, 3, 5], odd?)','let su = import("sequence"); su.remove([1, 2, 3, 1, 3, 5], even?)','let su = import("sequence"); su.remove("Albert Mojir", -> "aoueiyAOUEIY" contains? $)']}},"remove-at":{evaluate:([e,t],n)=>{x(t,n,{integer:!0}),b(e,n);const s=t<0?e.length+t:t;return s<0||s>=e.length?e:Array.isArray(e)?e.filter((e,t)=>t!==s):`${e.substring(0,s)}${e.substring(s+1)}`},arity:S(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"integer"},seq:{type:"sequence"},n:{type:"number"}},variants:[{argumentNames:["seq","n"]}],description:"Returns a new sequence of all items in $seq except item at position $n. If $n is negative, it is counting from the end of the sequence.",seeAlso:["sequence.remove","sequence.splice"],examples:['let su = import("sequence"); su.remove-at([1, 2, 3, 1, 3, 5], 2)','let su = import("sequence"); su.remove-at("Albert", -2)','let su = import("sequence"); su.remove-at([1, 2, 3, 1, 3, 5], 0)','let su = import("sequence"); su.remove-at([1, 2, 3, 1, 3, 5], -1)','let su = import("sequence"); su.remove-at("Albert Mojir", 6)']}},"split-at":{evaluate:([e,t],n)=>{x(t,n,{integer:!0}),b(e,n);const s=t<0?e.length+t:t;return[e.slice(0,s),e.slice(s)]},arity:S(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"integer"},seq:{type:"sequence"},n:{type:"number"}},variants:[{argumentNames:["seq","n"]}],description:"Returns a pair of sequence `[take(pos input), drop(pos input)]`.",seeAlso:["sequence.split-with","take","drop"],examples:['let su = import("sequence"); su.split-at([1, 2, 3, 4, 5], 2)','let su = import("sequence"); su.split-at("Albert", -2)','let su = import("sequence"); su.split-at([1, 2, 3, 4, 5], -2)','let su = import("sequence"); su.split-at("Albert", 2)']}},"split-with":{evaluate:([e,t],n,s,{executeFunction:r})=>{A(t,n),b(e,n);const u=Array.isArray(e);return C(L(u?e:e.split(""),e=>C(r(t,[e],s,n),e=>!e)),t=>-1===t?[e,u?[]:""]:[e.slice(0,t),e.slice(t)])},arity:S(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Returns a pair of sequences `[take-while(input, fun), drop-while(input, fun)]`.",seeAlso:["sequence.split-at","take-while","drop-while"],examples:['let su = import("sequence"); su.split-with([1, 2, 3, 4, 5], odd?)','let su = import("sequence"); su.split-with([1, 2, 3, 4, 5], -> $ > 3)','let su = import("sequence"); su.split-with("Albert", -> $ <= "o")']}},frequencies:{evaluate:([e],t)=>{b(e,t);return("string"==typeof e?e.split(""):e).reduce((e,n)=>(N(n,t),R(e,n)?e[n]=e[n]+1:e[n]=1,e),{})},arity:S(1),docs:{category:"sequence",returns:{type:"object"},args:{seq:{type:"sequence"}},variants:[{argumentNames:["seq"]}],description:"Returns an object from distinct items in $seq to the number of times they appear. Note that all items in $seq must be valid object keys i.e. strings.",seeAlso:["sequence.group-by","sequence.distinct","vector.count-values"],examples:['let su = import("sequence"); su.frequencies(["Albert", "Mojir", "Nina", "Mojir"])','let su = import("sequence"); su.frequencies("Pneumonoultramicroscopicsilicovolcanoconiosis")']}},"group-by":{evaluate:([e,t],n,s,{executeFunction:r})=>{A(t,n),b(e,n);return F(Array.isArray(e)?e:e.split(""),(e,u)=>C(r(t,[u],s,n),t=>(N(t,n),R(e,t)||(e[t]=[]),e[t].push(u),e)),{})},arity:S(2),docs:{category:"sequence",returns:{type:"object"},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Returns an object of the elements of $seq keyed by the result of $fun on each element. The value at each key will be an array of the corresponding elements.",seeAlso:["sequence.frequencies","sequence.partition-by"],examples:['let su = import("sequence"); su.group-by([{ name: "Albert" }, { name: "Albert" }, { name: "Mojir" }], "name")','let su = import("sequence"); su.group-by([{name: "Albert"}, {name: "Albert"}, {name: "Mojir"}], "name")','let su = import("sequence"); su.group-by("Albert Mojir", -> "aoueiAOUEI" contains? $ ? "vowel" : "other")']}},partition:{evaluate:(e,t)=>{const n=d(e[0],t),s=E(j(e[1],t)),r=e.length>=3?E(j(e[2],t)):s,u=4===e.length?null===e[3]?[]:function(e,t){return l(e,t),e}(e[3],t):void 0;return D(s,r,n,u,t)},arity:{min:2,max:4},docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"number"},seq:{type:"sequence"},n:{type:"number"},step:{type:"number"},pad:{type:"array"}},variants:[{argumentNames:["seq","n"]},{argumentNames:["seq","n","step"]},{argumentNames:["seq","n","step","pad"]}],description:"Returns an array of sequences of $n items each, at offsets $step apart. If $step is not supplied, defaults to $n. If a $pad array is supplied, use its elements as necessary to complete last partition upto $n items. In case there are not enough padding elements, return a partition with less than $n items.",seeAlso:["sequence.partition-all","sequence.partition-by"],examples:['let su = import("sequence"); su.partition(range(20), 4)','let su = import("sequence"); su.partition(range(20), 4)','let su = import("sequence"); su.partition(range(22), 4)','let su = import("sequence"); su.partition(range(20), 4, 6)','let su = import("sequence"); su.partition(range(20), 4, 3)','let su = import("sequence"); su.partition(range(20), 3, 6, ["a"])','let su = import("sequence"); su.partition(range(20), 4, 6, ["a"])','let su = import("sequence"); su.partition(range(20), 4, 6, ["a", "b", "c", "d"])','let su = import("sequence"); su.partition(["a", "b", "c", "d", "e", "f"], 3, 1)','let su = import("sequence"); su.partition([1, 2, 3, 4], 10)','let su = import("sequence"); su.partition([1, 2, 3, 4], 10, 10)','let su = import("sequence"); su.partition([1, 2, 3, 4], 10, 10, [])','let su = import("sequence"); su.partition([1, 2, 3, 4], 10, 10, null)','let su = import("sequence"); su.partition("superfragilistic", 5)','let su = import("sequence"); su.partition("superfragilistic", 5, 5, null)','let su = import("sequence"); let foo = [5, 6, 7, 8]; su.partition(foo, 2, 1, foo)']}},"partition-all":{evaluate:(e,t)=>{const n=d(e[0],t),s=E(j(e[1],t));return D(s,3===e.length?E(j(e[2],t)):s,n,[],t)},arity:{min:2,max:3},docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"number"},seq:{type:"sequence"},n:{type:"number"},step:{type:"number"}},variants:[{argumentNames:["seq","n"]},{argumentNames:["seq","n","step"]}],description:"Returns an array of sequences like partition, but may include partitions with fewer than n items at the end.",seeAlso:["sequence.partition","sequence.partition-by"],examples:['let su = import("sequence"); su.partition-all([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)','let su = import("sequence"); su.partition-all([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)','let su = import("sequence"); su.partition([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)','let su = import("sequence"); su.partition-all([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 2, 4)']}},"partition-by":{evaluate:([e,t],n,s,{executeFunction:r})=>{A(t,n),b(e,n);const u="string"==typeof e;return C(F(u?e.split(""):e,(e,u)=>C(r(t,[u],s,n),t=>(t!==e.oldValue&&(e.result.push([]),e.oldValue=t),e.result[e.result.length-1].push(u),e)),{result:[],oldValue:void 0}),({result:e})=>u?e.map(e=>e.join("")):e)},arity:S(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"function"},seq:{type:"sequence"},fun:{type:"function"}},variants:[{argumentNames:["seq","fun"]}],description:"Applies $fun to each value in $seq, splitting it each time $fun returns a new value. Returns an array of sequences.",seeAlso:["sequence.partition","sequence.partition-all","sequence.group-by"],examples:['let su = import("sequence"); su.partition-by([1, 2, 3, 4, 5], odd?)','let su = import("sequence"); su.partition-by([1, 2, 3, 4, 5], -> $ == 3)','let su = import("sequence"); su.partition-by([1, 1, 1, 2, 2, 3, 3], odd?)','let su = import("sequence"); su.partition-by("Leeeeeerrroyyy", identity)']}},"ends-with?":{evaluate:([e,t],n)=>(b(e,n),"string"==typeof e?(N(t,n),e.endsWith(t)):I(q(e.at(-1),n),q(t,n),n)),arity:S(2),docs:{category:"sequence",returns:{type:"boolean"},args:{a:{type:"sequence"},b:{type:"sequence"},seq:{type:"sequence"},suffix:{type:"sequence"}},variants:[{argumentNames:["seq","suffix"]}],description:"Returns `true` if $seq ends with $suffix, otherwise `false`.",seeAlso:["sequence.starts-with?"],examples:['let su = import("sequence"); su.ends-with?([[1], [2], [3], [4], [5]], [5])','let su = import("sequence"); su.ends-with?([[1], [2], [3], [4], [5]], 5)','let su = import("sequence"); su.ends-with?([1, 2, 3, 4, 5], 5)','let su = import("sequence"); su.ends-with?([1, 2, 3, 4, 5], [5])','let su = import("sequence"); su.ends-with?("Albert", "rt")','let su = import("sequence"); su.ends-with?("Albert", "RT")']}},"starts-with?":{evaluate:([e,t],n)=>(b(e,n),"string"==typeof e?(N(t,n),e.startsWith(t)):I(q(e[0],n),q(t,n),n)),arity:S(2),docs:{category:"sequence",returns:{type:"boolean"},args:{a:{type:"sequence"},b:{type:"sequence"},seq:{type:"sequence"},prefix:{type:"sequence"}},variants:[{argumentNames:["seq","prefix"]}],description:"Returns `true` if $seq starts with $prefix, otherwise `false`.",seeAlso:["sequence.ends-with?"],examples:['let su = import("sequence"); su.starts-with?([[1], [2], [3], [4], [5]], [1])','let su = import("sequence"); su.starts-with?([1, 2, 3, 4, 5], 1)','let su = import("sequence"); su.starts-with?([1, 2, 3, 4, 5], [1])','let su = import("sequence"); su.starts-with?("Albert", "Al")','let su = import("sequence"); su.starts-with?("Albert", "al")']}},interleave:{evaluate:([...e],t)=>{const n="string"==typeof e[0],s=n?e.map(e=>(N(e,t),e.split(""))):e.map(e=>(l(e,t),e)),r=Math.min(...s.map(e=>e.length)),u=[];for(let e=0;e<r;e+=1)for(const t of s)e<t.length&&u.push(t[e]);return n?u.join(""):u},arity:{min:1},docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"sequence"},seqs:{type:"sequence",rest:!0}},variants:[{argumentNames:["seqs"]}],description:"Returns a sequence of the first item from each of the $seqs, then the second item from each of the $seqs, until all items from the shortest seq are exhausted.",seeAlso:["sequence.interpose","zipmap"],examples:['let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6])','let su = import("sequence"); su.interleave("Albert", ".,.,.,")','let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6])','let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6], [7, 8, 9])','let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6], [7, 8])','let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6], [7])','let su = import("sequence"); su.interleave([1, 2, 3], [4, 5, 6], [])','let su = import("sequence"); su.interleave([1, 2, 3], [])','let su = import("sequence"); su.interleave([])']}},interpose:{evaluate:([e,t],n)=>{if(b(e,n),"string"==typeof e)return N(t,n),e.split("").join(t);if(0===e.length)return[];const s=[];for(let n=0;n<e.length-1;n+=1)s.push(e[n],t);return s.push(e[e.length-1]),s},arity:S(2),docs:{category:"sequence",returns:{type:"sequence"},args:{a:{type:"sequence"},b:{type:"any"},seq:{type:"sequence"},separator:{type:"any"}},variants:[{argumentNames:["seq","separator"]}],description:"Returns a sequence of the elements of $seq separated by $separator. If $seq is a string, the separator must be a string.",seeAlso:["sequence.interleave","join"],examples:['let su = import("sequence"); su.interpose("Albert", "-")','let su = import("sequence"); su.interpose([1, 2, 3, 4, 5], "a")','let su = import("sequence"); su.interpose(["Albert", "Mojir", "Nina"], ", ")','let su = import("sequence"); su.interpose("Albert", ".")']}}};function D(e,t,n,s,r){x(t,r,{positive:!0});const u="string"==typeof n,i=[];let o=0;e:for(;o<n.length;){const r=[];for(let u=o;u<o+e;u+=1)if(u>=n.length){const e=u-n.length;if(!s){o+=t;continue e}if(e>=s.length)break;r.push(s[e])}else r.push(n[u]);i.push(r),o+=t}return u?i.map(e=>e.join("")):i}const J={name:"sequence",functions:U};export{J as sequenceUtilsModule};
|
|
2
2
|
//# sourceMappingURL=sequence.esm.js.map
|