@cortex-js/compute-engine 0.57.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 +690 -53
- package/dist/compile.min.esm.js +251 -51
- package/dist/compile.min.umd.cjs +251 -51
- package/dist/compile.umd.cjs +690 -53
- package/dist/compute-engine.esm.js +1079 -132
- package/dist/compute-engine.min.esm.js +271 -71
- package/dist/compute-engine.min.umd.cjs +270 -70
- package/dist/compute-engine.umd.cjs +1079 -132
- package/dist/core.esm.js +1078 -131
- package/dist/core.min.esm.js +269 -69
- package/dist/core.min.umd.cjs +269 -69
- package/dist/core.umd.cjs +1078 -131
- package/dist/interval.esm.js +132 -15
- package/dist/interval.min.esm.js +6 -6
- package/dist/interval.min.umd.cjs +6 -6
- package/dist/interval.umd.cjs +132 -15
- package/dist/latex-syntax.esm.js +132 -15
- package/dist/latex-syntax.min.esm.js +6 -6
- package/dist/latex-syntax.min.umd.cjs +6 -6
- package/dist/latex-syntax.umd.cjs +132 -15
- 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 +3 -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 +8 -1
- 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 +17 -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 +1 -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 +1 -1
- 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 +34 -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.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Interval 0.
|
|
1
|
+
/** Interval 0.58.0 */
|
|
2
2
|
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Interval = {}));})(this, (function (exports) { 'use strict';
|
|
3
3
|
var Interval = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -5218,7 +5218,42 @@ var Interval = (() => {
|
|
|
5218
5218
|
if (b === "nothing") return a;
|
|
5219
5219
|
if (isSubtype(a, b)) return b;
|
|
5220
5220
|
if (isSubtype(b, a)) return a;
|
|
5221
|
-
|
|
5221
|
+
const sup = superType(a, b);
|
|
5222
|
+
if (LOSSY_SUPERTYPE.has(sup)) return unionTypes(a, b);
|
|
5223
|
+
return sup;
|
|
5224
|
+
}
|
|
5225
|
+
var LOSSY_SUPERTYPE = /* @__PURE__ */ new Set([
|
|
5226
|
+
"scalar",
|
|
5227
|
+
"value",
|
|
5228
|
+
"function",
|
|
5229
|
+
"expression",
|
|
5230
|
+
"collection",
|
|
5231
|
+
"indexed_collection",
|
|
5232
|
+
"list",
|
|
5233
|
+
"set",
|
|
5234
|
+
"tuple",
|
|
5235
|
+
"record",
|
|
5236
|
+
"dictionary",
|
|
5237
|
+
"map",
|
|
5238
|
+
"any"
|
|
5239
|
+
]);
|
|
5240
|
+
function unionTypes(a, b) {
|
|
5241
|
+
const members = [];
|
|
5242
|
+
const push = (t) => {
|
|
5243
|
+
if (typeof t === "object" && t.kind === "union") {
|
|
5244
|
+
for (const m of t.types) push(m);
|
|
5245
|
+
return;
|
|
5246
|
+
}
|
|
5247
|
+
const key = typeof t === "string" ? t : JSON.stringify(t);
|
|
5248
|
+
if (!members.some(
|
|
5249
|
+
(m) => (typeof m === "string" ? m : JSON.stringify(m)) === key
|
|
5250
|
+
))
|
|
5251
|
+
members.push(t);
|
|
5252
|
+
};
|
|
5253
|
+
push(a);
|
|
5254
|
+
push(b);
|
|
5255
|
+
if (members.length === 1) return members[0];
|
|
5256
|
+
return { kind: "union", types: members };
|
|
5222
5257
|
}
|
|
5223
5258
|
function narrow(...types) {
|
|
5224
5259
|
if (types.length === 0) return "nothing";
|
|
@@ -6374,15 +6409,16 @@ var Interval = (() => {
|
|
|
6374
6409
|
precedence: ASSIGNMENT_PRECEDENCE,
|
|
6375
6410
|
parse: parseAssign
|
|
6376
6411
|
},
|
|
6377
|
-
// General colon operator (type annotation, mapping notation)
|
|
6378
|
-
// Precedence below
|
|
6379
|
-
// and below arrows (270) so
|
|
6412
|
+
// General colon operator (type annotation, mapping notation, Desmos piecewise)
|
|
6413
|
+
// Precedence below comparisons (245) so `cond : val` (Desmos compact piecewise)
|
|
6414
|
+
// parses as `Colon(cond, val)`, and below arrows (270) so
|
|
6415
|
+
// `f: A \to B` parses as `Colon(f, To(A, B))`.
|
|
6380
6416
|
{
|
|
6381
6417
|
name: "Colon",
|
|
6382
6418
|
latexTrigger: ":",
|
|
6383
6419
|
kind: "infix",
|
|
6384
6420
|
associativity: "right",
|
|
6385
|
-
precedence:
|
|
6421
|
+
precedence: 240,
|
|
6386
6422
|
serialize: (serializer, expr) => joinLatex([
|
|
6387
6423
|
serializer.serialize(operand(expr, 1)),
|
|
6388
6424
|
"\\colon",
|
|
@@ -6393,7 +6429,7 @@ var Interval = (() => {
|
|
|
6393
6429
|
latexTrigger: "\\colon",
|
|
6394
6430
|
kind: "infix",
|
|
6395
6431
|
associativity: "right",
|
|
6396
|
-
precedence:
|
|
6432
|
+
precedence: 240,
|
|
6397
6433
|
parse: "Colon"
|
|
6398
6434
|
},
|
|
6399
6435
|
{
|
|
@@ -7963,7 +7999,10 @@ var Interval = (() => {
|
|
|
7963
7999
|
p.skipVisualSpace();
|
|
7964
8000
|
const isComma = p.peek === ",";
|
|
7965
8001
|
p.index = saved;
|
|
7966
|
-
return
|
|
8002
|
+
if (isComma) return true;
|
|
8003
|
+
if (peekKeyword(p, "where")) return true;
|
|
8004
|
+
if (peekKeyword(p, "with")) return true;
|
|
8005
|
+
return false;
|
|
7967
8006
|
}
|
|
7968
8007
|
};
|
|
7969
8008
|
const elements = [];
|
|
@@ -8004,6 +8043,25 @@ var Interval = (() => {
|
|
|
8004
8043
|
parser.skipVisualSpace();
|
|
8005
8044
|
} while (parser.match(","));
|
|
8006
8045
|
if (bindings.length === 0) return null;
|
|
8046
|
+
const forStart = parser.index;
|
|
8047
|
+
if (matchKeyword(parser, "for")) {
|
|
8048
|
+
const loop = parseForComprehension(parser, lhs, until);
|
|
8049
|
+
if (loop) {
|
|
8050
|
+
const block2 = [];
|
|
8051
|
+
for (const b of bindings) {
|
|
8052
|
+
const normalized = normalizeLocalAssign(b);
|
|
8053
|
+
if (operator(normalized) === "Assign") {
|
|
8054
|
+
block2.push(["Declare", operand(normalized, 1)]);
|
|
8055
|
+
block2.push(normalized);
|
|
8056
|
+
} else {
|
|
8057
|
+
block2.push(normalized);
|
|
8058
|
+
}
|
|
8059
|
+
}
|
|
8060
|
+
block2.push(loop);
|
|
8061
|
+
return ["Block", ...block2];
|
|
8062
|
+
}
|
|
8063
|
+
parser.index = forStart;
|
|
8064
|
+
}
|
|
8007
8065
|
const block = [];
|
|
8008
8066
|
for (const b of bindings) {
|
|
8009
8067
|
const normalized = normalizeLocalAssign(b);
|
|
@@ -8217,6 +8275,17 @@ var Interval = (() => {
|
|
|
8217
8275
|
const upperExpr = openRight ? ["Open", upper] : upper;
|
|
8218
8276
|
return ["Interval", lowerExpr, upperExpr];
|
|
8219
8277
|
}
|
|
8278
|
+
var COMPARISON_HEADS = /* @__PURE__ */ new Set([
|
|
8279
|
+
"Less",
|
|
8280
|
+
"LessEqual",
|
|
8281
|
+
"Greater",
|
|
8282
|
+
"GreaterEqual",
|
|
8283
|
+
"Equal",
|
|
8284
|
+
"NotEqual",
|
|
8285
|
+
"And",
|
|
8286
|
+
"Or",
|
|
8287
|
+
"Not"
|
|
8288
|
+
]);
|
|
8220
8289
|
var DEFINITIONS_SETS = [
|
|
8221
8290
|
//
|
|
8222
8291
|
// Constants
|
|
@@ -8475,18 +8544,58 @@ var Interval = (() => {
|
|
|
8475
8544
|
closeTrigger: "}",
|
|
8476
8545
|
parse: (_parser, body) => {
|
|
8477
8546
|
if (isEmptySequence(body)) return "EmptySet";
|
|
8547
|
+
if (operator(body) == "Delimiter" && stringValue(operand(body, 2)) === ",") {
|
|
8548
|
+
body = operand(body, 1);
|
|
8549
|
+
}
|
|
8478
8550
|
const h = operator(body);
|
|
8479
|
-
if (h === "Divides"
|
|
8551
|
+
if (h === "Divides") {
|
|
8480
8552
|
const expr = operand(body, 1);
|
|
8481
8553
|
const condition = operand(body, 2);
|
|
8482
8554
|
if (expr !== null && condition !== null)
|
|
8483
8555
|
return ["Set", expr, ["Condition", condition]];
|
|
8484
8556
|
}
|
|
8485
|
-
if (
|
|
8486
|
-
|
|
8557
|
+
if (h === "Colon") {
|
|
8558
|
+
const lhs = operand(body, 1);
|
|
8559
|
+
const rhs = operand(body, 2);
|
|
8560
|
+
if (lhs !== null && rhs !== null) {
|
|
8561
|
+
const lhsOp = operator(lhs);
|
|
8562
|
+
if (lhsOp !== null && COMPARISON_HEADS.has(lhsOp)) {
|
|
8563
|
+
return ["Which", lhs, rhs];
|
|
8564
|
+
}
|
|
8565
|
+
return ["Set", lhs, ["Condition", rhs]];
|
|
8566
|
+
}
|
|
8567
|
+
}
|
|
8568
|
+
if (h === "Sequence") {
|
|
8569
|
+
const elements = operands(body);
|
|
8570
|
+
const colonElements = elements.filter((el) => operator(el) === "Colon");
|
|
8571
|
+
const allPiecewise = colonElements.length > 0 && colonElements.every((el) => {
|
|
8572
|
+
const lhs = operand(el, 1);
|
|
8573
|
+
const lhsOp = lhs !== null ? operator(lhs) : null;
|
|
8574
|
+
return lhsOp !== null && COMPARISON_HEADS.has(lhsOp);
|
|
8575
|
+
});
|
|
8576
|
+
if (allPiecewise) {
|
|
8577
|
+
const whichOps = [];
|
|
8578
|
+
for (let i = 0; i < elements.length; i++) {
|
|
8579
|
+
const el = elements[i];
|
|
8580
|
+
if (operator(el) === "Colon") {
|
|
8581
|
+
const cond = operand(el, 1);
|
|
8582
|
+
const val = operand(el, 2);
|
|
8583
|
+
if (cond === null || val === null) {
|
|
8584
|
+
return ["Set", ...elements];
|
|
8585
|
+
}
|
|
8586
|
+
whichOps.push(cond, val);
|
|
8587
|
+
} else {
|
|
8588
|
+
if (i !== elements.length - 1) {
|
|
8589
|
+
return ["Set", ...elements];
|
|
8590
|
+
}
|
|
8591
|
+
whichOps.push("True", el);
|
|
8592
|
+
}
|
|
8593
|
+
}
|
|
8594
|
+
return ["Which", ...whichOps];
|
|
8595
|
+
}
|
|
8596
|
+
return ["Set", ...elements];
|
|
8487
8597
|
}
|
|
8488
|
-
|
|
8489
|
-
return ["Set", ...operands(body)];
|
|
8598
|
+
return ["Set", body];
|
|
8490
8599
|
},
|
|
8491
8600
|
serialize: (serializer, expr) => {
|
|
8492
8601
|
if (nops(expr) === 2 && operator(operand(expr, 2)) === "Condition") {
|
|
@@ -10460,7 +10569,8 @@ var Interval = (() => {
|
|
|
10460
10569
|
minPrec: MULTIPLICATION_PRECEDENCE,
|
|
10461
10570
|
condition: (parser2) => trigCommands[parser2.peek] || (until?.condition?.(parser2) ?? false)
|
|
10462
10571
|
});
|
|
10463
|
-
const
|
|
10572
|
+
const head = fn === "Arctan" && args?.length === 2 ? "Arctan2" : fn;
|
|
10573
|
+
const appliedFn = args === null ? fn : typeof head === "string" ? [head, ...args] : ["Apply", head, ...args];
|
|
10464
10574
|
return sup === null ? appliedFn : ["Power", appliedFn, sup];
|
|
10465
10575
|
};
|
|
10466
10576
|
}
|
|
@@ -12583,10 +12693,17 @@ var Interval = (() => {
|
|
|
12583
12693
|
// The capitalized library entries already exist; these are pure parse
|
|
12584
12694
|
// aliases so the lowercase names don't land in `unsupported-operator`.
|
|
12585
12695
|
// ---------------------------------------------------------------------------
|
|
12696
|
+
{ latexTrigger: "\\operatorname{count}", parse: "Length" },
|
|
12586
12697
|
{ latexTrigger: "\\operatorname{random}", parse: "Random" },
|
|
12587
12698
|
{ latexTrigger: "\\operatorname{shuffle}", parse: "Shuffle" },
|
|
12588
12699
|
{ latexTrigger: "\\operatorname{repeat}", parse: "Repeat" },
|
|
12589
12700
|
{ latexTrigger: "\\operatorname{join}", parse: "Join" },
|
|
12701
|
+
{ latexTrigger: "\\operatorname{range}", parse: "Range" },
|
|
12702
|
+
// Note: `\operatorname{with}` (Desmos's local-binding clause) is intentionally
|
|
12703
|
+
// NOT registered here. Use the math-notation equivalent `\operatorname{where}`
|
|
12704
|
+
// (with `\coloneq` for bindings), or register `with` as a custom dictionary
|
|
12705
|
+
// entry at the integration layer — see the "Desmos-Specific Syntax — Prefer
|
|
12706
|
+
// Custom LaTeX Dictionary" section in COMPUTE_ENGINE.md for a worked example.
|
|
12590
12707
|
// ---------------------------------------------------------------------------
|
|
12591
12708
|
// Geometric primitive heads. Registered as known typed heads so consumers
|
|
12592
12709
|
// can branch on the operator name; CE itself doesn't render them. The
|
|
@@ -13865,7 +13982,7 @@ var Interval = (() => {
|
|
|
13865
13982
|
};
|
|
13866
13983
|
|
|
13867
13984
|
// src/interval.ts
|
|
13868
|
-
var version = "0.
|
|
13985
|
+
var version = "0.58.0";
|
|
13869
13986
|
return __toCommonJS(interval_exports);
|
|
13870
13987
|
})();
|
|
13871
13988
|
/*! Bundled license information:
|
package/dist/latex-syntax.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.
|
|
1
|
+
/** Compute Engine 0.58.0 */
|
|
2
2
|
|
|
3
3
|
// src/math-json/utils.ts
|
|
4
4
|
var MISSING = ["Error", "'missing'"];
|
|
@@ -3126,7 +3126,42 @@ function widen2(a, b) {
|
|
|
3126
3126
|
if (b === "nothing") return a;
|
|
3127
3127
|
if (isSubtype(a, b)) return b;
|
|
3128
3128
|
if (isSubtype(b, a)) return a;
|
|
3129
|
-
|
|
3129
|
+
const sup = superType(a, b);
|
|
3130
|
+
if (LOSSY_SUPERTYPE.has(sup)) return unionTypes(a, b);
|
|
3131
|
+
return sup;
|
|
3132
|
+
}
|
|
3133
|
+
var LOSSY_SUPERTYPE = /* @__PURE__ */ new Set([
|
|
3134
|
+
"scalar",
|
|
3135
|
+
"value",
|
|
3136
|
+
"function",
|
|
3137
|
+
"expression",
|
|
3138
|
+
"collection",
|
|
3139
|
+
"indexed_collection",
|
|
3140
|
+
"list",
|
|
3141
|
+
"set",
|
|
3142
|
+
"tuple",
|
|
3143
|
+
"record",
|
|
3144
|
+
"dictionary",
|
|
3145
|
+
"map",
|
|
3146
|
+
"any"
|
|
3147
|
+
]);
|
|
3148
|
+
function unionTypes(a, b) {
|
|
3149
|
+
const members = [];
|
|
3150
|
+
const push = (t) => {
|
|
3151
|
+
if (typeof t === "object" && t.kind === "union") {
|
|
3152
|
+
for (const m of t.types) push(m);
|
|
3153
|
+
return;
|
|
3154
|
+
}
|
|
3155
|
+
const key = typeof t === "string" ? t : JSON.stringify(t);
|
|
3156
|
+
if (!members.some(
|
|
3157
|
+
(m) => (typeof m === "string" ? m : JSON.stringify(m)) === key
|
|
3158
|
+
))
|
|
3159
|
+
members.push(t);
|
|
3160
|
+
};
|
|
3161
|
+
push(a);
|
|
3162
|
+
push(b);
|
|
3163
|
+
if (members.length === 1) return members[0];
|
|
3164
|
+
return { kind: "union", types: members };
|
|
3130
3165
|
}
|
|
3131
3166
|
function narrow(...types) {
|
|
3132
3167
|
if (types.length === 0) return "nothing";
|
|
@@ -4014,15 +4049,16 @@ var DEFINITIONS_CORE = [
|
|
|
4014
4049
|
precedence: ASSIGNMENT_PRECEDENCE,
|
|
4015
4050
|
parse: parseAssign
|
|
4016
4051
|
},
|
|
4017
|
-
// General colon operator (type annotation, mapping notation)
|
|
4018
|
-
// Precedence below
|
|
4019
|
-
// and below arrows (270) so
|
|
4052
|
+
// General colon operator (type annotation, mapping notation, Desmos piecewise)
|
|
4053
|
+
// Precedence below comparisons (245) so `cond : val` (Desmos compact piecewise)
|
|
4054
|
+
// parses as `Colon(cond, val)`, and below arrows (270) so
|
|
4055
|
+
// `f: A \to B` parses as `Colon(f, To(A, B))`.
|
|
4020
4056
|
{
|
|
4021
4057
|
name: "Colon",
|
|
4022
4058
|
latexTrigger: ":",
|
|
4023
4059
|
kind: "infix",
|
|
4024
4060
|
associativity: "right",
|
|
4025
|
-
precedence:
|
|
4061
|
+
precedence: 240,
|
|
4026
4062
|
serialize: (serializer, expr) => joinLatex([
|
|
4027
4063
|
serializer.serialize(operand(expr, 1)),
|
|
4028
4064
|
"\\colon",
|
|
@@ -4033,7 +4069,7 @@ var DEFINITIONS_CORE = [
|
|
|
4033
4069
|
latexTrigger: "\\colon",
|
|
4034
4070
|
kind: "infix",
|
|
4035
4071
|
associativity: "right",
|
|
4036
|
-
precedence:
|
|
4072
|
+
precedence: 240,
|
|
4037
4073
|
parse: "Colon"
|
|
4038
4074
|
},
|
|
4039
4075
|
{
|
|
@@ -5603,7 +5639,10 @@ function parseForComprehension(parser, lhs, until) {
|
|
|
5603
5639
|
p.skipVisualSpace();
|
|
5604
5640
|
const isComma = p.peek === ",";
|
|
5605
5641
|
p.index = saved;
|
|
5606
|
-
return
|
|
5642
|
+
if (isComma) return true;
|
|
5643
|
+
if (peekKeyword(p, "where")) return true;
|
|
5644
|
+
if (peekKeyword(p, "with")) return true;
|
|
5645
|
+
return false;
|
|
5607
5646
|
}
|
|
5608
5647
|
};
|
|
5609
5648
|
const elements = [];
|
|
@@ -5644,6 +5683,25 @@ function parseWhereExpression(parser, lhs, until) {
|
|
|
5644
5683
|
parser.skipVisualSpace();
|
|
5645
5684
|
} while (parser.match(","));
|
|
5646
5685
|
if (bindings.length === 0) return null;
|
|
5686
|
+
const forStart = parser.index;
|
|
5687
|
+
if (matchKeyword(parser, "for")) {
|
|
5688
|
+
const loop = parseForComprehension(parser, lhs, until);
|
|
5689
|
+
if (loop) {
|
|
5690
|
+
const block2 = [];
|
|
5691
|
+
for (const b of bindings) {
|
|
5692
|
+
const normalized = normalizeLocalAssign(b);
|
|
5693
|
+
if (operator(normalized) === "Assign") {
|
|
5694
|
+
block2.push(["Declare", operand(normalized, 1)]);
|
|
5695
|
+
block2.push(normalized);
|
|
5696
|
+
} else {
|
|
5697
|
+
block2.push(normalized);
|
|
5698
|
+
}
|
|
5699
|
+
}
|
|
5700
|
+
block2.push(loop);
|
|
5701
|
+
return ["Block", ...block2];
|
|
5702
|
+
}
|
|
5703
|
+
parser.index = forStart;
|
|
5704
|
+
}
|
|
5647
5705
|
const block = [];
|
|
5648
5706
|
for (const b of bindings) {
|
|
5649
5707
|
const normalized = normalizeLocalAssign(b);
|
|
@@ -5857,6 +5915,17 @@ function parseIntervalBody(body, openLeft, openRight) {
|
|
|
5857
5915
|
const upperExpr = openRight ? ["Open", upper] : upper;
|
|
5858
5916
|
return ["Interval", lowerExpr, upperExpr];
|
|
5859
5917
|
}
|
|
5918
|
+
var COMPARISON_HEADS = /* @__PURE__ */ new Set([
|
|
5919
|
+
"Less",
|
|
5920
|
+
"LessEqual",
|
|
5921
|
+
"Greater",
|
|
5922
|
+
"GreaterEqual",
|
|
5923
|
+
"Equal",
|
|
5924
|
+
"NotEqual",
|
|
5925
|
+
"And",
|
|
5926
|
+
"Or",
|
|
5927
|
+
"Not"
|
|
5928
|
+
]);
|
|
5860
5929
|
var DEFINITIONS_SETS = [
|
|
5861
5930
|
//
|
|
5862
5931
|
// Constants
|
|
@@ -6115,18 +6184,58 @@ var DEFINITIONS_SETS = [
|
|
|
6115
6184
|
closeTrigger: "}",
|
|
6116
6185
|
parse: (_parser, body) => {
|
|
6117
6186
|
if (isEmptySequence(body)) return "EmptySet";
|
|
6187
|
+
if (operator(body) == "Delimiter" && stringValue(operand(body, 2)) === ",") {
|
|
6188
|
+
body = operand(body, 1);
|
|
6189
|
+
}
|
|
6118
6190
|
const h = operator(body);
|
|
6119
|
-
if (h === "Divides"
|
|
6191
|
+
if (h === "Divides") {
|
|
6120
6192
|
const expr = operand(body, 1);
|
|
6121
6193
|
const condition = operand(body, 2);
|
|
6122
6194
|
if (expr !== null && condition !== null)
|
|
6123
6195
|
return ["Set", expr, ["Condition", condition]];
|
|
6124
6196
|
}
|
|
6125
|
-
if (
|
|
6126
|
-
|
|
6197
|
+
if (h === "Colon") {
|
|
6198
|
+
const lhs = operand(body, 1);
|
|
6199
|
+
const rhs = operand(body, 2);
|
|
6200
|
+
if (lhs !== null && rhs !== null) {
|
|
6201
|
+
const lhsOp = operator(lhs);
|
|
6202
|
+
if (lhsOp !== null && COMPARISON_HEADS.has(lhsOp)) {
|
|
6203
|
+
return ["Which", lhs, rhs];
|
|
6204
|
+
}
|
|
6205
|
+
return ["Set", lhs, ["Condition", rhs]];
|
|
6206
|
+
}
|
|
6207
|
+
}
|
|
6208
|
+
if (h === "Sequence") {
|
|
6209
|
+
const elements = operands(body);
|
|
6210
|
+
const colonElements = elements.filter((el) => operator(el) === "Colon");
|
|
6211
|
+
const allPiecewise = colonElements.length > 0 && colonElements.every((el) => {
|
|
6212
|
+
const lhs = operand(el, 1);
|
|
6213
|
+
const lhsOp = lhs !== null ? operator(lhs) : null;
|
|
6214
|
+
return lhsOp !== null && COMPARISON_HEADS.has(lhsOp);
|
|
6215
|
+
});
|
|
6216
|
+
if (allPiecewise) {
|
|
6217
|
+
const whichOps = [];
|
|
6218
|
+
for (let i = 0; i < elements.length; i++) {
|
|
6219
|
+
const el = elements[i];
|
|
6220
|
+
if (operator(el) === "Colon") {
|
|
6221
|
+
const cond = operand(el, 1);
|
|
6222
|
+
const val = operand(el, 2);
|
|
6223
|
+
if (cond === null || val === null) {
|
|
6224
|
+
return ["Set", ...elements];
|
|
6225
|
+
}
|
|
6226
|
+
whichOps.push(cond, val);
|
|
6227
|
+
} else {
|
|
6228
|
+
if (i !== elements.length - 1) {
|
|
6229
|
+
return ["Set", ...elements];
|
|
6230
|
+
}
|
|
6231
|
+
whichOps.push("True", el);
|
|
6232
|
+
}
|
|
6233
|
+
}
|
|
6234
|
+
return ["Which", ...whichOps];
|
|
6235
|
+
}
|
|
6236
|
+
return ["Set", ...elements];
|
|
6127
6237
|
}
|
|
6128
|
-
|
|
6129
|
-
return ["Set", ...operands(body)];
|
|
6238
|
+
return ["Set", body];
|
|
6130
6239
|
},
|
|
6131
6240
|
serialize: (serializer, expr) => {
|
|
6132
6241
|
if (nops(expr) === 2 && operator(operand(expr, 2)) === "Condition") {
|
|
@@ -8130,7 +8239,8 @@ function parseTrig(op) {
|
|
|
8130
8239
|
minPrec: MULTIPLICATION_PRECEDENCE,
|
|
8131
8240
|
condition: (parser2) => trigCommands[parser2.peek] || (until?.condition?.(parser2) ?? false)
|
|
8132
8241
|
});
|
|
8133
|
-
const
|
|
8242
|
+
const head = fn === "Arctan" && args?.length === 2 ? "Arctan2" : fn;
|
|
8243
|
+
const appliedFn = args === null ? fn : typeof head === "string" ? [head, ...args] : ["Apply", head, ...args];
|
|
8134
8244
|
return sup === null ? appliedFn : ["Power", appliedFn, sup];
|
|
8135
8245
|
};
|
|
8136
8246
|
}
|
|
@@ -10253,10 +10363,17 @@ var DEFINITIONS_OTHERS = [
|
|
|
10253
10363
|
// The capitalized library entries already exist; these are pure parse
|
|
10254
10364
|
// aliases so the lowercase names don't land in `unsupported-operator`.
|
|
10255
10365
|
// ---------------------------------------------------------------------------
|
|
10366
|
+
{ latexTrigger: "\\operatorname{count}", parse: "Length" },
|
|
10256
10367
|
{ latexTrigger: "\\operatorname{random}", parse: "Random" },
|
|
10257
10368
|
{ latexTrigger: "\\operatorname{shuffle}", parse: "Shuffle" },
|
|
10258
10369
|
{ latexTrigger: "\\operatorname{repeat}", parse: "Repeat" },
|
|
10259
10370
|
{ latexTrigger: "\\operatorname{join}", parse: "Join" },
|
|
10371
|
+
{ latexTrigger: "\\operatorname{range}", parse: "Range" },
|
|
10372
|
+
// Note: `\operatorname{with}` (Desmos's local-binding clause) is intentionally
|
|
10373
|
+
// NOT registered here. Use the math-notation equivalent `\operatorname{where}`
|
|
10374
|
+
// (with `\coloneq` for bindings), or register `with` as a custom dictionary
|
|
10375
|
+
// entry at the integration layer — see the "Desmos-Specific Syntax — Prefer
|
|
10376
|
+
// Custom LaTeX Dictionary" section in COMPUTE_ENGINE.md for a worked example.
|
|
10260
10377
|
// ---------------------------------------------------------------------------
|
|
10261
10378
|
// Geometric primitive heads. Registered as known typed heads so consumers
|
|
10262
10379
|
// can branch on the operator name; CE itself doesn't render them. The
|
|
@@ -15710,7 +15827,7 @@ function serialize(expr) {
|
|
|
15710
15827
|
}
|
|
15711
15828
|
|
|
15712
15829
|
// src/latex-syntax.ts
|
|
15713
|
-
var version = "0.
|
|
15830
|
+
var version = "0.58.0";
|
|
15714
15831
|
export {
|
|
15715
15832
|
DEFINITIONS_ALGEBRA as ALGEBRA_DICTIONARY,
|
|
15716
15833
|
DEFINITIONS_ARITHMETIC as ARITHMETIC_DICTIONARY,
|