@cortex-js/compute-engine 0.56.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compile.esm.js +1137 -92
- package/dist/compile.min.esm.js +261 -61
- package/dist/compile.min.umd.cjs +262 -62
- package/dist/compile.umd.cjs +1137 -92
- package/dist/compute-engine.esm.js +1751 -176
- package/dist/compute-engine.min.esm.js +273 -73
- package/dist/compute-engine.min.umd.cjs +272 -72
- package/dist/compute-engine.umd.cjs +1751 -176
- package/dist/core.esm.js +1750 -175
- package/dist/core.min.esm.js +271 -71
- package/dist/core.min.umd.cjs +271 -71
- package/dist/core.umd.cjs +1750 -175
- package/dist/interval.esm.js +357 -28
- package/dist/interval.min.esm.js +6 -6
- package/dist/interval.min.umd.cjs +6 -6
- package/dist/interval.umd.cjs +357 -28
- package/dist/latex-syntax.esm.js +398 -28
- package/dist/latex-syntax.min.esm.js +6 -6
- package/dist/latex-syntax.min.umd.cjs +6 -6
- package/dist/latex-syntax.umd.cjs +398 -28
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.umd.cjs +2 -2
- package/dist/math-json.umd.cjs +2 -2
- package/dist/numerics.esm.js +38 -3
- package/dist/numerics.min.esm.js +3 -3
- package/dist/numerics.min.umd.cjs +4 -4
- package/dist/numerics.umd.cjs +38 -3
- package/dist/types/big-decimal/big-decimal.d.ts +1 -1
- package/dist/types/big-decimal/index.d.ts +1 -1
- package/dist/types/big-decimal/transcendentals.d.ts +1 -1
- package/dist/types/big-decimal/utils.d.ts +1 -1
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/configuration-change.d.ts +1 -1
- package/dist/types/common/fuzzy-string-match.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/interruptible.d.ts +1 -1
- package/dist/types/common/one-of.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/type/ast-nodes.d.ts +1 -1
- package/dist/types/common/type/boxed-type.d.ts +1 -1
- package/dist/types/common/type/lexer.d.ts +1 -1
- package/dist/types/common/type/parse.d.ts +1 -1
- package/dist/types/common/type/parser.d.ts +1 -1
- package/dist/types/common/type/primitive.d.ts +1 -1
- package/dist/types/common/type/reduce.d.ts +1 -1
- package/dist/types/common/type/serialize.d.ts +1 -1
- package/dist/types/common/type/subtype.d.ts +1 -1
- package/dist/types/common/type/type-builder.d.ts +1 -1
- package/dist/types/common/type/types.d.ts +1 -1
- package/dist/types/common/type/utils.d.ts +1 -1
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compile.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +8 -1
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +7 -1
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/constants.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/inequality-bounds.d.ts +22 -10
- package/dist/types/compute-engine/boxed-expression/init-lazy-refs.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/invisible-operator.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/pattern-utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomial-degree.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/predicates.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/stochastic-equal.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/type-guards.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
- package/dist/types/compute-engine/collection-utils.d.ts +1 -1
- package/dist/types/compute-engine/compilation/base-compiler.d.ts +62 -6
- package/dist/types/compute-engine/compilation/compile-expression.d.ts +1 -1
- package/dist/types/compute-engine/compilation/constant-folding.d.ts +1 -1
- package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/gpu-target.d.ts +44 -1
- package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/javascript-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/python-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/types.d.ts +1 -1
- package/dist/types/compute-engine/compilation/wgsl-target.d.ts +1 -1
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/engine-assumptions.d.ts +1 -1
- package/dist/types/compute-engine/engine-cache.d.ts +1 -1
- package/dist/types/compute-engine/engine-common-symbols.d.ts +1 -1
- package/dist/types/compute-engine/engine-compilation-targets.d.ts +1 -1
- package/dist/types/compute-engine/engine-configuration-lifecycle.d.ts +1 -1
- package/dist/types/compute-engine/engine-declarations.d.ts +1 -1
- package/dist/types/compute-engine/engine-expression-entrypoints.d.ts +1 -1
- package/dist/types/compute-engine/engine-extension-contracts.d.ts +1 -1
- package/dist/types/compute-engine/engine-library-bootstrap.d.ts +1 -1
- package/dist/types/compute-engine/engine-numeric-configuration.d.ts +1 -1
- package/dist/types/compute-engine/engine-runtime-state.d.ts +4 -1
- package/dist/types/compute-engine/engine-scope.d.ts +1 -1
- package/dist/types/compute-engine/engine-sequences.d.ts +1 -1
- package/dist/types/compute-engine/engine-simplification-rules.d.ts +1 -1
- package/dist/types/compute-engine/engine-startup-coordinator.d.ts +1 -1
- package/dist/types/compute-engine/engine-type-resolver.d.ts +1 -1
- package/dist/types/compute-engine/engine-validation-entrypoints.d.ts +1 -1
- package/dist/types/compute-engine/free-functions.d.ts +1 -1
- package/dist/types/compute-engine/function-utils.d.ts +1 -1
- package/dist/types/compute-engine/global-types.d.ts +1 -1
- package/dist/types/compute-engine/index.d.ts +18 -2
- package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
- package/dist/types/compute-engine/interval/elementary.d.ts +1 -1
- package/dist/types/compute-engine/interval/index.d.ts +1 -1
- package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -1
- package/dist/types/compute-engine/interval/types.d.ts +1 -1
- package/dist/types/compute-engine/interval/util.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/default-dictionary.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-colors.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-units.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/indexed-types.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serialize-dms.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/types.d.ts +40 -1
- package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +5 -3
- package/dist/types/compute-engine/library/colors.d.ts +1 -1
- package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/fractals.d.ts +1 -1
- package/dist/types/compute-engine/library/library.d.ts +1 -1
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/quantity-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/type-handlers.d.ts +1 -1
- package/dist/types/compute-engine/library/unit-data.d.ts +1 -1
- package/dist/types/compute-engine/library/units.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/types.d.ts +1 -1
- package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
- package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
- package/dist/types/compute-engine/numerics/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/random.d.ts +23 -0
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/special-functions.d.ts +1 -1
- package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
- package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
- package/dist/types/compute-engine/numerics/types.d.ts +1 -1
- package/dist/types/compute-engine/numerics/unit-data.d.ts +1 -1
- package/dist/types/compute-engine/oeis.d.ts +1 -1
- package/dist/types/compute-engine/sequence.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-cost.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/logic-utils.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-factorial.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-logic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensor-fields.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensors.d.ts +1 -1
- package/dist/types/compute-engine/types-definitions.d.ts +1 -1
- package/dist/types/compute-engine/types-engine.d.ts +51 -1
- package/dist/types/compute-engine/types-evaluation.d.ts +1 -1
- package/dist/types/compute-engine/types-expression.d.ts +69 -1
- package/dist/types/compute-engine/types-kernel-evaluation.d.ts +1 -1
- package/dist/types/compute-engine/types-kernel-serialization.d.ts +1 -1
- package/dist/types/compute-engine/types-serialization.d.ts +1 -1
- package/dist/types/compute-engine/types.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +1 -1
- package/dist/types/core.d.ts +1 -1
- package/dist/types/interval.d.ts +1 -1
- package/dist/types/latex-syntax.d.ts +2 -2
- package/dist/types/math-json/symbols.d.ts +1 -1
- package/dist/types/math-json/types.d.ts +1 -1
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +2 -2
- package/dist/types/numerics.d.ts +1 -1
- package/package.json +1 -1
package/dist/interval.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.
|
|
1
|
+
/** Compute Engine 0.58.0 */
|
|
2
2
|
|
|
3
3
|
// src/compute-engine/interval/util.ts
|
|
4
4
|
function ok(value) {
|
|
@@ -5099,7 +5099,42 @@ function widen2(a, b) {
|
|
|
5099
5099
|
if (b === "nothing") return a;
|
|
5100
5100
|
if (isSubtype(a, b)) return b;
|
|
5101
5101
|
if (isSubtype(b, a)) return a;
|
|
5102
|
-
|
|
5102
|
+
const sup = superType(a, b);
|
|
5103
|
+
if (LOSSY_SUPERTYPE.has(sup)) return unionTypes(a, b);
|
|
5104
|
+
return sup;
|
|
5105
|
+
}
|
|
5106
|
+
var LOSSY_SUPERTYPE = /* @__PURE__ */ new Set([
|
|
5107
|
+
"scalar",
|
|
5108
|
+
"value",
|
|
5109
|
+
"function",
|
|
5110
|
+
"expression",
|
|
5111
|
+
"collection",
|
|
5112
|
+
"indexed_collection",
|
|
5113
|
+
"list",
|
|
5114
|
+
"set",
|
|
5115
|
+
"tuple",
|
|
5116
|
+
"record",
|
|
5117
|
+
"dictionary",
|
|
5118
|
+
"map",
|
|
5119
|
+
"any"
|
|
5120
|
+
]);
|
|
5121
|
+
function unionTypes(a, b) {
|
|
5122
|
+
const members = [];
|
|
5123
|
+
const push = (t) => {
|
|
5124
|
+
if (typeof t === "object" && t.kind === "union") {
|
|
5125
|
+
for (const m of t.types) push(m);
|
|
5126
|
+
return;
|
|
5127
|
+
}
|
|
5128
|
+
const key = typeof t === "string" ? t : JSON.stringify(t);
|
|
5129
|
+
if (!members.some(
|
|
5130
|
+
(m) => (typeof m === "string" ? m : JSON.stringify(m)) === key
|
|
5131
|
+
))
|
|
5132
|
+
members.push(t);
|
|
5133
|
+
};
|
|
5134
|
+
push(a);
|
|
5135
|
+
push(b);
|
|
5136
|
+
if (members.length === 1) return members[0];
|
|
5137
|
+
return { kind: "union", types: members };
|
|
5103
5138
|
}
|
|
5104
5139
|
function narrow(...types) {
|
|
5105
5140
|
if (types.length === 0) return "nothing";
|
|
@@ -5922,6 +5957,64 @@ function parseQuantifier(kind) {
|
|
|
5922
5957
|
}
|
|
5923
5958
|
|
|
5924
5959
|
// src/compute-engine/latex-syntax/dictionary/definitions-core.ts
|
|
5960
|
+
var COMPONENT_ACCESS_HEADS = {
|
|
5961
|
+
x: "First",
|
|
5962
|
+
y: "Second",
|
|
5963
|
+
z: "Third",
|
|
5964
|
+
real: "Real",
|
|
5965
|
+
re: "Real",
|
|
5966
|
+
imag: "Imaginary",
|
|
5967
|
+
im: "Imaginary",
|
|
5968
|
+
count: "Length",
|
|
5969
|
+
total: "Sum",
|
|
5970
|
+
max: "Max",
|
|
5971
|
+
min: "Min"
|
|
5972
|
+
};
|
|
5973
|
+
function memberHead(name) {
|
|
5974
|
+
return COMPONENT_ACCESS_HEADS[name] ?? null;
|
|
5975
|
+
}
|
|
5976
|
+
function parseComponentAccess(parser, lhs) {
|
|
5977
|
+
parser.skipVisualSpace();
|
|
5978
|
+
if (parser.match("\\operatorname")) {
|
|
5979
|
+
const name = parser.parseStringGroup();
|
|
5980
|
+
if (name === null) return null;
|
|
5981
|
+
const head = memberHead(name.trim());
|
|
5982
|
+
if (head === null) return null;
|
|
5983
|
+
return [head, lhs];
|
|
5984
|
+
}
|
|
5985
|
+
const tok = parser.peek;
|
|
5986
|
+
if (typeof tok === "string" && tok.startsWith("\\")) {
|
|
5987
|
+
const bare = tok.slice(1);
|
|
5988
|
+
const head = memberHead(bare);
|
|
5989
|
+
if (head !== null) {
|
|
5990
|
+
parser.nextToken();
|
|
5991
|
+
return [head, lhs];
|
|
5992
|
+
}
|
|
5993
|
+
return null;
|
|
5994
|
+
}
|
|
5995
|
+
if (typeof tok === "string" && /^[a-zA-Z]$/.test(tok)) {
|
|
5996
|
+
const head = memberHead(tok);
|
|
5997
|
+
if (head === null) return null;
|
|
5998
|
+
parser.nextToken();
|
|
5999
|
+
return [head, lhs];
|
|
6000
|
+
}
|
|
6001
|
+
return null;
|
|
6002
|
+
}
|
|
6003
|
+
function parseWhenRestriction(parser, lhs, close) {
|
|
6004
|
+
parser.addBoundary(close);
|
|
6005
|
+
parser.skipVisualSpace();
|
|
6006
|
+
const cond = parser.parseExpression({ minPrec: 0 });
|
|
6007
|
+
if (cond === null) {
|
|
6008
|
+
parser.removeBoundary();
|
|
6009
|
+
return null;
|
|
6010
|
+
}
|
|
6011
|
+
parser.skipVisualSpace();
|
|
6012
|
+
if (!parser.matchBoundary()) {
|
|
6013
|
+
parser.removeBoundary();
|
|
6014
|
+
return null;
|
|
6015
|
+
}
|
|
6016
|
+
return ["When", lhs, cond];
|
|
6017
|
+
}
|
|
5925
6018
|
function parseSequence(parser, terminator, lhs, prec, sep) {
|
|
5926
6019
|
if (terminator && terminator.minPrec >= prec) return null;
|
|
5927
6020
|
const result = lhs ? [lhs] : ["Nothing"];
|
|
@@ -6197,15 +6290,16 @@ var DEFINITIONS_CORE = [
|
|
|
6197
6290
|
precedence: ASSIGNMENT_PRECEDENCE,
|
|
6198
6291
|
parse: parseAssign
|
|
6199
6292
|
},
|
|
6200
|
-
// General colon operator (type annotation, mapping notation)
|
|
6201
|
-
// Precedence below
|
|
6202
|
-
// and below arrows (270) so
|
|
6293
|
+
// General colon operator (type annotation, mapping notation, Desmos piecewise)
|
|
6294
|
+
// Precedence below comparisons (245) so `cond : val` (Desmos compact piecewise)
|
|
6295
|
+
// parses as `Colon(cond, val)`, and below arrows (270) so
|
|
6296
|
+
// `f: A \to B` parses as `Colon(f, To(A, B))`.
|
|
6203
6297
|
{
|
|
6204
6298
|
name: "Colon",
|
|
6205
6299
|
latexTrigger: ":",
|
|
6206
6300
|
kind: "infix",
|
|
6207
6301
|
associativity: "right",
|
|
6208
|
-
precedence:
|
|
6302
|
+
precedence: 240,
|
|
6209
6303
|
serialize: (serializer, expr) => joinLatex([
|
|
6210
6304
|
serializer.serialize(operand(expr, 1)),
|
|
6211
6305
|
"\\colon",
|
|
@@ -6216,7 +6310,7 @@ var DEFINITIONS_CORE = [
|
|
|
6216
6310
|
latexTrigger: "\\colon",
|
|
6217
6311
|
kind: "infix",
|
|
6218
6312
|
associativity: "right",
|
|
6219
|
-
precedence:
|
|
6313
|
+
precedence: 240,
|
|
6220
6314
|
parse: "Colon"
|
|
6221
6315
|
},
|
|
6222
6316
|
{
|
|
@@ -6393,6 +6487,15 @@ var DEFINITIONS_CORE = [
|
|
|
6393
6487
|
}
|
|
6394
6488
|
},
|
|
6395
6489
|
{ name: "LatexTokens", serialize: serializeLatexTokens },
|
|
6490
|
+
// Component-access postfix: expr.member (C3)
|
|
6491
|
+
// The '.' trigger is consumed before the parse function is called.
|
|
6492
|
+
// Precedence 850 > 810 (At/indexing) so .x chains tightly.
|
|
6493
|
+
{
|
|
6494
|
+
kind: "postfix",
|
|
6495
|
+
precedence: 850,
|
|
6496
|
+
latexTrigger: ["."],
|
|
6497
|
+
parse: parseComponentAccess
|
|
6498
|
+
},
|
|
6396
6499
|
{
|
|
6397
6500
|
name: "At",
|
|
6398
6501
|
kind: "postfix",
|
|
@@ -6413,6 +6516,29 @@ var DEFINITIONS_CORE = [
|
|
|
6413
6516
|
latexTrigger: ["\\left", "\\lbrack"],
|
|
6414
6517
|
parse: parseAt("\\right", "\\rbrack")
|
|
6415
6518
|
},
|
|
6519
|
+
// When-restriction: `expr\left\{cond\right\}` → `When(expr, cond)` (D3)
|
|
6520
|
+
{
|
|
6521
|
+
name: "When",
|
|
6522
|
+
kind: "postfix",
|
|
6523
|
+
precedence: 800,
|
|
6524
|
+
latexTrigger: ["\\left", "\\{"],
|
|
6525
|
+
parse: (parser, lhs) => parseWhenRestriction(parser, lhs, ["\\right", "\\}"]),
|
|
6526
|
+
serialize: (serializer, expr) => {
|
|
6527
|
+
const e = operand(expr, 1);
|
|
6528
|
+
const cond = operand(expr, 2);
|
|
6529
|
+
if (!e || !cond) return "";
|
|
6530
|
+
const clauses = operator(cond) === "And" ? operands(cond) ?? [] : [cond];
|
|
6531
|
+
const inner = clauses.map((c) => `\\left\\{${serializer.serialize(c)}\\right\\}`).join("");
|
|
6532
|
+
return `${serializer.serialize(e)}${inner}`;
|
|
6533
|
+
}
|
|
6534
|
+
},
|
|
6535
|
+
// When-restriction: bare `expr\{cond\}` → `When(expr, cond)`
|
|
6536
|
+
{
|
|
6537
|
+
kind: "postfix",
|
|
6538
|
+
precedence: 800,
|
|
6539
|
+
latexTrigger: ["\\{"],
|
|
6540
|
+
parse: (parser, lhs) => parseWhenRestriction(parser, lhs, ["\\}"])
|
|
6541
|
+
},
|
|
6416
6542
|
{
|
|
6417
6543
|
kind: "postfix",
|
|
6418
6544
|
latexTrigger: ["_"],
|
|
@@ -6495,6 +6621,29 @@ var DEFINITIONS_CORE = [
|
|
|
6495
6621
|
return "";
|
|
6496
6622
|
}
|
|
6497
6623
|
},
|
|
6624
|
+
// Additional triggers for Range: `...`, `\ldots`, and `\dots` are
|
|
6625
|
+
// equivalent to `..` when used as infix operators (e.g. `[1...9]`).
|
|
6626
|
+
// No `name` field here — names must be unique per the dictionary rules;
|
|
6627
|
+
// the first Range entry owns the name. When there is no LHS the symbol
|
|
6628
|
+
// entries near the top of the file still fire (ContinuationPlaceholder).
|
|
6629
|
+
{
|
|
6630
|
+
latexTrigger: [".", ".", "."],
|
|
6631
|
+
kind: "infix",
|
|
6632
|
+
precedence: 800,
|
|
6633
|
+
parse: parseRange
|
|
6634
|
+
},
|
|
6635
|
+
{
|
|
6636
|
+
latexTrigger: ["\\ldots"],
|
|
6637
|
+
kind: "infix",
|
|
6638
|
+
precedence: 800,
|
|
6639
|
+
parse: parseRange
|
|
6640
|
+
},
|
|
6641
|
+
{
|
|
6642
|
+
latexTrigger: ["\\dots"],
|
|
6643
|
+
kind: "infix",
|
|
6644
|
+
precedence: 800,
|
|
6645
|
+
parse: parseRange
|
|
6646
|
+
},
|
|
6498
6647
|
{
|
|
6499
6648
|
latexTrigger: [";"],
|
|
6500
6649
|
kind: "infix",
|
|
@@ -6679,13 +6828,24 @@ var DEFINITIONS_CORE = [
|
|
|
6679
6828
|
const args = operands(expr);
|
|
6680
6829
|
if (!args || args.length < 2) return "";
|
|
6681
6830
|
const body = args[0];
|
|
6682
|
-
const
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6831
|
+
const elements = args.slice(1);
|
|
6832
|
+
const allElements = elements.every((e) => operator(e) === "Element");
|
|
6833
|
+
if (!allElements) {
|
|
6834
|
+
return joinLatex([
|
|
6835
|
+
"\\operatorname{Loop}(",
|
|
6836
|
+
serializer.serialize(body),
|
|
6837
|
+
", ",
|
|
6838
|
+
serializer.serialize(elements[0]),
|
|
6839
|
+
")"
|
|
6840
|
+
]);
|
|
6841
|
+
}
|
|
6842
|
+
if (elements.length === 1) {
|
|
6843
|
+
const elem = elements[0];
|
|
6844
|
+
const index = operand(elem, 1);
|
|
6845
|
+
const coll = operand(elem, 2);
|
|
6846
|
+
if (operator(coll) === "Range") {
|
|
6847
|
+
const lo = operand(coll, 1);
|
|
6848
|
+
const hi = operand(coll, 2);
|
|
6689
6849
|
return joinLatex([
|
|
6690
6850
|
"\\text{for }",
|
|
6691
6851
|
serializer.serialize(index),
|
|
@@ -6697,13 +6857,27 @@ var DEFINITIONS_CORE = [
|
|
|
6697
6857
|
serializer.serialize(body)
|
|
6698
6858
|
]);
|
|
6699
6859
|
}
|
|
6860
|
+
return joinLatex([
|
|
6861
|
+
serializer.serialize(body),
|
|
6862
|
+
" \\operatorname{for} ",
|
|
6863
|
+
serializer.serialize(index),
|
|
6864
|
+
" = ",
|
|
6865
|
+
serializer.serialize(coll)
|
|
6866
|
+
]);
|
|
6700
6867
|
}
|
|
6868
|
+
const bindings = elements.map((elem) => {
|
|
6869
|
+
const name = operand(elem, 1);
|
|
6870
|
+
const coll = operand(elem, 2);
|
|
6871
|
+
return joinLatex([
|
|
6872
|
+
serializer.serialize(name),
|
|
6873
|
+
" = ",
|
|
6874
|
+
serializer.serialize(coll)
|
|
6875
|
+
]);
|
|
6876
|
+
}).join(", ");
|
|
6701
6877
|
return joinLatex([
|
|
6702
|
-
"\\operatorname{Loop}(",
|
|
6703
6878
|
serializer.serialize(body),
|
|
6704
|
-
"
|
|
6705
|
-
|
|
6706
|
-
")"
|
|
6879
|
+
" \\operatorname{for} ",
|
|
6880
|
+
bindings
|
|
6707
6881
|
]);
|
|
6708
6882
|
}
|
|
6709
6883
|
},
|
|
@@ -6736,6 +6910,18 @@ var DEFINITIONS_CORE = [
|
|
|
6736
6910
|
precedence: 245,
|
|
6737
6911
|
parse: (parser, until) => parseForExpression(parser, until)
|
|
6738
6912
|
},
|
|
6913
|
+
// \operatorname{for} as postfix infix (list comprehension):
|
|
6914
|
+
// `body \operatorname{for} x = L_1, y = L_2`
|
|
6915
|
+
// Precedence 19 — just below comma (20) so the body is allowed to use
|
|
6916
|
+
// any operator (including comma sequencing) up to the keyword, and the
|
|
6917
|
+
// bindings can be comma-separated below us.
|
|
6918
|
+
{
|
|
6919
|
+
symbolTrigger: "for",
|
|
6920
|
+
kind: "infix",
|
|
6921
|
+
associativity: "none",
|
|
6922
|
+
precedence: 19,
|
|
6923
|
+
parse: (parser, lhs, until) => parseForComprehension(parser, lhs, until)
|
|
6924
|
+
},
|
|
6739
6925
|
// \operatorname{break}
|
|
6740
6926
|
{
|
|
6741
6927
|
symbolTrigger: "break",
|
|
@@ -6940,7 +7126,10 @@ var DEFINITIONS_CORE = [
|
|
|
6940
7126
|
if (!sym || !parser.getSymbolType(sym).matches("function")) return null;
|
|
6941
7127
|
parser.addBoundary([")"]);
|
|
6942
7128
|
const expr = parser.parseExpression(until);
|
|
6943
|
-
if (!parser.matchBoundary())
|
|
7129
|
+
if (!parser.matchBoundary()) {
|
|
7130
|
+
parser.removeBoundary();
|
|
7131
|
+
return null;
|
|
7132
|
+
}
|
|
6944
7133
|
if (!parser.match("<}>")) return null;
|
|
6945
7134
|
return ["Derivative", lhs, expr];
|
|
6946
7135
|
}
|
|
@@ -7381,7 +7570,12 @@ function parseBrackets(parser, body) {
|
|
|
7381
7570
|
if (isEmptySequence(body)) return ["List"];
|
|
7382
7571
|
const h = operator(body);
|
|
7383
7572
|
if (h === "Range" || h === "Linspace") return body;
|
|
7384
|
-
if (h === "Sequence")
|
|
7573
|
+
if (h === "Sequence") {
|
|
7574
|
+
const elems = operands(body);
|
|
7575
|
+
const inferred = tryInferRangeFromElements(elems, parser);
|
|
7576
|
+
if (inferred) return inferred;
|
|
7577
|
+
return ["List", ...elems];
|
|
7578
|
+
}
|
|
7385
7579
|
if (h === "Delimiter") {
|
|
7386
7580
|
const delim = stringValue(operand(body, 2)) ?? "...";
|
|
7387
7581
|
if (delim === ";" || delim === ".;.") {
|
|
@@ -7394,12 +7588,37 @@ function parseBrackets(parser, body) {
|
|
|
7394
7588
|
}
|
|
7395
7589
|
if (delim === "," || delim === ".,.") {
|
|
7396
7590
|
body = operand(body, 1);
|
|
7397
|
-
if (operator(body) === "Sequence")
|
|
7591
|
+
if (operator(body) === "Sequence") {
|
|
7592
|
+
const elems = operands(body);
|
|
7593
|
+
const inferred = tryInferRangeFromElements(elems, parser);
|
|
7594
|
+
if (inferred) return inferred;
|
|
7595
|
+
return ["List", ...elems];
|
|
7596
|
+
}
|
|
7398
7597
|
return ["List", body ?? "Nothing"];
|
|
7399
7598
|
}
|
|
7400
7599
|
}
|
|
7401
7600
|
return ["List", body];
|
|
7402
7601
|
}
|
|
7602
|
+
function tryInferRangeFromElements(elems, parser) {
|
|
7603
|
+
if (elems.length < 4) return null;
|
|
7604
|
+
const penultimate = elems[elems.length - 2];
|
|
7605
|
+
if (symbol(penultimate) !== "ContinuationPlaceholder") return null;
|
|
7606
|
+
const samples = elems.slice(0, -2);
|
|
7607
|
+
const endExpr = elems[elems.length - 1];
|
|
7608
|
+
if (samples.length < 2) return null;
|
|
7609
|
+
const sampleNums = samples.map(machineValue);
|
|
7610
|
+
if (sampleNums.some((n) => n === null)) return null;
|
|
7611
|
+
const nums = sampleNums;
|
|
7612
|
+
const step = nums[nums.length - 1] - nums[nums.length - 2];
|
|
7613
|
+
const tol = parser.options.tolerance;
|
|
7614
|
+
if (Math.abs(step) < tol)
|
|
7615
|
+
return parser.error("degenerate-range-step", parser.index);
|
|
7616
|
+
for (let i = 1; i < nums.length; i++) {
|
|
7617
|
+
if (Math.abs(nums[i] - nums[i - 1] - step) > tol)
|
|
7618
|
+
return parser.error("inconsistent-range-samples", parser.index);
|
|
7619
|
+
}
|
|
7620
|
+
return ["Range", nums[0], endExpr, step];
|
|
7621
|
+
}
|
|
7403
7622
|
function serializeList(serializer, expr) {
|
|
7404
7623
|
if (nops(expr) > 1 && operands(expr).every((x) => {
|
|
7405
7624
|
const op = operator(x);
|
|
@@ -7651,6 +7870,38 @@ function parseForExpression(parser, until) {
|
|
|
7651
7870
|
["Element", index, ["Range", lower, upper]]
|
|
7652
7871
|
];
|
|
7653
7872
|
}
|
|
7873
|
+
function parseForComprehension(parser, lhs, until) {
|
|
7874
|
+
const bindingTerminator = {
|
|
7875
|
+
minPrec: 21,
|
|
7876
|
+
// Above comma (20) and ; (19), so `x = L_1` is captured whole
|
|
7877
|
+
condition: (p) => {
|
|
7878
|
+
if (until?.condition?.(p)) return true;
|
|
7879
|
+
const saved = p.index;
|
|
7880
|
+
p.skipVisualSpace();
|
|
7881
|
+
const isComma = p.peek === ",";
|
|
7882
|
+
p.index = saved;
|
|
7883
|
+
if (isComma) return true;
|
|
7884
|
+
if (peekKeyword(p, "where")) return true;
|
|
7885
|
+
if (peekKeyword(p, "with")) return true;
|
|
7886
|
+
return false;
|
|
7887
|
+
}
|
|
7888
|
+
};
|
|
7889
|
+
const elements = [];
|
|
7890
|
+
do {
|
|
7891
|
+
parser.skipVisualSpace();
|
|
7892
|
+
const binding = parser.parseExpression(bindingTerminator);
|
|
7893
|
+
if (binding === null) break;
|
|
7894
|
+
const op = operator(binding);
|
|
7895
|
+
if (op !== "Equal" && op !== "Assign") return null;
|
|
7896
|
+
const name = operand(binding, 1);
|
|
7897
|
+
const list = operand(binding, 2);
|
|
7898
|
+
if (!name || !list) return null;
|
|
7899
|
+
elements.push(["Element", name, list]);
|
|
7900
|
+
parser.skipVisualSpace();
|
|
7901
|
+
} while (parser.match(","));
|
|
7902
|
+
if (elements.length === 0) return null;
|
|
7903
|
+
return ["Loop", lhs, ...elements];
|
|
7904
|
+
}
|
|
7654
7905
|
function parseWhereExpression(parser, lhs, until) {
|
|
7655
7906
|
const bindingTerminator = {
|
|
7656
7907
|
minPrec: 21,
|
|
@@ -7673,6 +7924,25 @@ function parseWhereExpression(parser, lhs, until) {
|
|
|
7673
7924
|
parser.skipVisualSpace();
|
|
7674
7925
|
} while (parser.match(","));
|
|
7675
7926
|
if (bindings.length === 0) return null;
|
|
7927
|
+
const forStart = parser.index;
|
|
7928
|
+
if (matchKeyword(parser, "for")) {
|
|
7929
|
+
const loop = parseForComprehension(parser, lhs, until);
|
|
7930
|
+
if (loop) {
|
|
7931
|
+
const block2 = [];
|
|
7932
|
+
for (const b of bindings) {
|
|
7933
|
+
const normalized = normalizeLocalAssign(b);
|
|
7934
|
+
if (operator(normalized) === "Assign") {
|
|
7935
|
+
block2.push(["Declare", operand(normalized, 1)]);
|
|
7936
|
+
block2.push(normalized);
|
|
7937
|
+
} else {
|
|
7938
|
+
block2.push(normalized);
|
|
7939
|
+
}
|
|
7940
|
+
}
|
|
7941
|
+
block2.push(loop);
|
|
7942
|
+
return ["Block", ...block2];
|
|
7943
|
+
}
|
|
7944
|
+
parser.index = forStart;
|
|
7945
|
+
}
|
|
7676
7946
|
const block = [];
|
|
7677
7947
|
for (const b of bindings) {
|
|
7678
7948
|
const normalized = normalizeLocalAssign(b);
|
|
@@ -7886,6 +8156,17 @@ function parseIntervalBody(body, openLeft, openRight) {
|
|
|
7886
8156
|
const upperExpr = openRight ? ["Open", upper] : upper;
|
|
7887
8157
|
return ["Interval", lowerExpr, upperExpr];
|
|
7888
8158
|
}
|
|
8159
|
+
var COMPARISON_HEADS = /* @__PURE__ */ new Set([
|
|
8160
|
+
"Less",
|
|
8161
|
+
"LessEqual",
|
|
8162
|
+
"Greater",
|
|
8163
|
+
"GreaterEqual",
|
|
8164
|
+
"Equal",
|
|
8165
|
+
"NotEqual",
|
|
8166
|
+
"And",
|
|
8167
|
+
"Or",
|
|
8168
|
+
"Not"
|
|
8169
|
+
]);
|
|
7889
8170
|
var DEFINITIONS_SETS = [
|
|
7890
8171
|
//
|
|
7891
8172
|
// Constants
|
|
@@ -8144,18 +8425,58 @@ var DEFINITIONS_SETS = [
|
|
|
8144
8425
|
closeTrigger: "}",
|
|
8145
8426
|
parse: (_parser, body) => {
|
|
8146
8427
|
if (isEmptySequence(body)) return "EmptySet";
|
|
8428
|
+
if (operator(body) == "Delimiter" && stringValue(operand(body, 2)) === ",") {
|
|
8429
|
+
body = operand(body, 1);
|
|
8430
|
+
}
|
|
8147
8431
|
const h = operator(body);
|
|
8148
|
-
if (h === "Divides"
|
|
8432
|
+
if (h === "Divides") {
|
|
8149
8433
|
const expr = operand(body, 1);
|
|
8150
8434
|
const condition = operand(body, 2);
|
|
8151
8435
|
if (expr !== null && condition !== null)
|
|
8152
8436
|
return ["Set", expr, ["Condition", condition]];
|
|
8153
8437
|
}
|
|
8154
|
-
if (
|
|
8155
|
-
|
|
8438
|
+
if (h === "Colon") {
|
|
8439
|
+
const lhs = operand(body, 1);
|
|
8440
|
+
const rhs = operand(body, 2);
|
|
8441
|
+
if (lhs !== null && rhs !== null) {
|
|
8442
|
+
const lhsOp = operator(lhs);
|
|
8443
|
+
if (lhsOp !== null && COMPARISON_HEADS.has(lhsOp)) {
|
|
8444
|
+
return ["Which", lhs, rhs];
|
|
8445
|
+
}
|
|
8446
|
+
return ["Set", lhs, ["Condition", rhs]];
|
|
8447
|
+
}
|
|
8448
|
+
}
|
|
8449
|
+
if (h === "Sequence") {
|
|
8450
|
+
const elements = operands(body);
|
|
8451
|
+
const colonElements = elements.filter((el) => operator(el) === "Colon");
|
|
8452
|
+
const allPiecewise = colonElements.length > 0 && colonElements.every((el) => {
|
|
8453
|
+
const lhs = operand(el, 1);
|
|
8454
|
+
const lhsOp = lhs !== null ? operator(lhs) : null;
|
|
8455
|
+
return lhsOp !== null && COMPARISON_HEADS.has(lhsOp);
|
|
8456
|
+
});
|
|
8457
|
+
if (allPiecewise) {
|
|
8458
|
+
const whichOps = [];
|
|
8459
|
+
for (let i = 0; i < elements.length; i++) {
|
|
8460
|
+
const el = elements[i];
|
|
8461
|
+
if (operator(el) === "Colon") {
|
|
8462
|
+
const cond = operand(el, 1);
|
|
8463
|
+
const val = operand(el, 2);
|
|
8464
|
+
if (cond === null || val === null) {
|
|
8465
|
+
return ["Set", ...elements];
|
|
8466
|
+
}
|
|
8467
|
+
whichOps.push(cond, val);
|
|
8468
|
+
} else {
|
|
8469
|
+
if (i !== elements.length - 1) {
|
|
8470
|
+
return ["Set", ...elements];
|
|
8471
|
+
}
|
|
8472
|
+
whichOps.push("True", el);
|
|
8473
|
+
}
|
|
8474
|
+
}
|
|
8475
|
+
return ["Which", ...whichOps];
|
|
8476
|
+
}
|
|
8477
|
+
return ["Set", ...elements];
|
|
8156
8478
|
}
|
|
8157
|
-
|
|
8158
|
-
return ["Set", ...operands(body)];
|
|
8479
|
+
return ["Set", body];
|
|
8159
8480
|
},
|
|
8160
8481
|
serialize: (serializer, expr) => {
|
|
8161
8482
|
if (nops(expr) === 2 && operator(operand(expr, 2)) === "Condition") {
|
|
@@ -10129,7 +10450,8 @@ function parseTrig(op) {
|
|
|
10129
10450
|
minPrec: MULTIPLICATION_PRECEDENCE,
|
|
10130
10451
|
condition: (parser2) => trigCommands[parser2.peek] || (until?.condition?.(parser2) ?? false)
|
|
10131
10452
|
});
|
|
10132
|
-
const
|
|
10453
|
+
const head = fn === "Arctan" && args?.length === 2 ? "Arctan2" : fn;
|
|
10454
|
+
const appliedFn = args === null ? fn : typeof head === "string" ? [head, ...args] : ["Apply", head, ...args];
|
|
10133
10455
|
return sup === null ? appliedFn : ["Power", appliedFn, sup];
|
|
10134
10456
|
};
|
|
10135
10457
|
}
|
|
@@ -12252,10 +12574,17 @@ var DEFINITIONS_OTHERS = [
|
|
|
12252
12574
|
// The capitalized library entries already exist; these are pure parse
|
|
12253
12575
|
// aliases so the lowercase names don't land in `unsupported-operator`.
|
|
12254
12576
|
// ---------------------------------------------------------------------------
|
|
12577
|
+
{ latexTrigger: "\\operatorname{count}", parse: "Length" },
|
|
12255
12578
|
{ latexTrigger: "\\operatorname{random}", parse: "Random" },
|
|
12256
12579
|
{ latexTrigger: "\\operatorname{shuffle}", parse: "Shuffle" },
|
|
12257
12580
|
{ latexTrigger: "\\operatorname{repeat}", parse: "Repeat" },
|
|
12258
12581
|
{ latexTrigger: "\\operatorname{join}", parse: "Join" },
|
|
12582
|
+
{ latexTrigger: "\\operatorname{range}", parse: "Range" },
|
|
12583
|
+
// Note: `\operatorname{with}` (Desmos's local-binding clause) is intentionally
|
|
12584
|
+
// NOT registered here. Use the math-notation equivalent `\operatorname{where}`
|
|
12585
|
+
// (with `\coloneq` for bindings), or register `with` as a custom dictionary
|
|
12586
|
+
// entry at the integration layer — see the "Desmos-Specific Syntax — Prefer
|
|
12587
|
+
// Custom LaTeX Dictionary" section in COMPUTE_ENGINE.md for a worked example.
|
|
12259
12588
|
// ---------------------------------------------------------------------------
|
|
12260
12589
|
// Geometric primitive heads. Registered as known typed heads so consumers
|
|
12261
12590
|
// can branch on the operator name; CE itself doesn't render them. The
|
|
@@ -13534,7 +13863,7 @@ var IntervalArithmetic = {
|
|
|
13534
13863
|
};
|
|
13535
13864
|
|
|
13536
13865
|
// src/interval.ts
|
|
13537
|
-
var version = "0.
|
|
13866
|
+
var version = "0.58.0";
|
|
13538
13867
|
export {
|
|
13539
13868
|
IntervalArithmetic,
|
|
13540
13869
|
_mul,
|