@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.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";
|
|
@@ -6255,15 +6290,16 @@ var DEFINITIONS_CORE = [
|
|
|
6255
6290
|
precedence: ASSIGNMENT_PRECEDENCE,
|
|
6256
6291
|
parse: parseAssign
|
|
6257
6292
|
},
|
|
6258
|
-
// General colon operator (type annotation, mapping notation)
|
|
6259
|
-
// Precedence below
|
|
6260
|
-
// 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))`.
|
|
6261
6297
|
{
|
|
6262
6298
|
name: "Colon",
|
|
6263
6299
|
latexTrigger: ":",
|
|
6264
6300
|
kind: "infix",
|
|
6265
6301
|
associativity: "right",
|
|
6266
|
-
precedence:
|
|
6302
|
+
precedence: 240,
|
|
6267
6303
|
serialize: (serializer, expr) => joinLatex([
|
|
6268
6304
|
serializer.serialize(operand(expr, 1)),
|
|
6269
6305
|
"\\colon",
|
|
@@ -6274,7 +6310,7 @@ var DEFINITIONS_CORE = [
|
|
|
6274
6310
|
latexTrigger: "\\colon",
|
|
6275
6311
|
kind: "infix",
|
|
6276
6312
|
associativity: "right",
|
|
6277
|
-
precedence:
|
|
6313
|
+
precedence: 240,
|
|
6278
6314
|
parse: "Colon"
|
|
6279
6315
|
},
|
|
6280
6316
|
{
|
|
@@ -7844,7 +7880,10 @@ function parseForComprehension(parser, lhs, until) {
|
|
|
7844
7880
|
p.skipVisualSpace();
|
|
7845
7881
|
const isComma = p.peek === ",";
|
|
7846
7882
|
p.index = saved;
|
|
7847
|
-
return
|
|
7883
|
+
if (isComma) return true;
|
|
7884
|
+
if (peekKeyword(p, "where")) return true;
|
|
7885
|
+
if (peekKeyword(p, "with")) return true;
|
|
7886
|
+
return false;
|
|
7848
7887
|
}
|
|
7849
7888
|
};
|
|
7850
7889
|
const elements = [];
|
|
@@ -7885,6 +7924,25 @@ function parseWhereExpression(parser, lhs, until) {
|
|
|
7885
7924
|
parser.skipVisualSpace();
|
|
7886
7925
|
} while (parser.match(","));
|
|
7887
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
|
+
}
|
|
7888
7946
|
const block = [];
|
|
7889
7947
|
for (const b of bindings) {
|
|
7890
7948
|
const normalized = normalizeLocalAssign(b);
|
|
@@ -8098,6 +8156,17 @@ function parseIntervalBody(body, openLeft, openRight) {
|
|
|
8098
8156
|
const upperExpr = openRight ? ["Open", upper] : upper;
|
|
8099
8157
|
return ["Interval", lowerExpr, upperExpr];
|
|
8100
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
|
+
]);
|
|
8101
8170
|
var DEFINITIONS_SETS = [
|
|
8102
8171
|
//
|
|
8103
8172
|
// Constants
|
|
@@ -8356,18 +8425,58 @@ var DEFINITIONS_SETS = [
|
|
|
8356
8425
|
closeTrigger: "}",
|
|
8357
8426
|
parse: (_parser, body) => {
|
|
8358
8427
|
if (isEmptySequence(body)) return "EmptySet";
|
|
8428
|
+
if (operator(body) == "Delimiter" && stringValue(operand(body, 2)) === ",") {
|
|
8429
|
+
body = operand(body, 1);
|
|
8430
|
+
}
|
|
8359
8431
|
const h = operator(body);
|
|
8360
|
-
if (h === "Divides"
|
|
8432
|
+
if (h === "Divides") {
|
|
8361
8433
|
const expr = operand(body, 1);
|
|
8362
8434
|
const condition = operand(body, 2);
|
|
8363
8435
|
if (expr !== null && condition !== null)
|
|
8364
8436
|
return ["Set", expr, ["Condition", condition]];
|
|
8365
8437
|
}
|
|
8366
|
-
if (
|
|
8367
|
-
|
|
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];
|
|
8368
8478
|
}
|
|
8369
|
-
|
|
8370
|
-
return ["Set", ...operands(body)];
|
|
8479
|
+
return ["Set", body];
|
|
8371
8480
|
},
|
|
8372
8481
|
serialize: (serializer, expr) => {
|
|
8373
8482
|
if (nops(expr) === 2 && operator(operand(expr, 2)) === "Condition") {
|
|
@@ -10341,7 +10450,8 @@ function parseTrig(op) {
|
|
|
10341
10450
|
minPrec: MULTIPLICATION_PRECEDENCE,
|
|
10342
10451
|
condition: (parser2) => trigCommands[parser2.peek] || (until?.condition?.(parser2) ?? false)
|
|
10343
10452
|
});
|
|
10344
|
-
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];
|
|
10345
10455
|
return sup === null ? appliedFn : ["Power", appliedFn, sup];
|
|
10346
10456
|
};
|
|
10347
10457
|
}
|
|
@@ -12464,10 +12574,17 @@ var DEFINITIONS_OTHERS = [
|
|
|
12464
12574
|
// The capitalized library entries already exist; these are pure parse
|
|
12465
12575
|
// aliases so the lowercase names don't land in `unsupported-operator`.
|
|
12466
12576
|
// ---------------------------------------------------------------------------
|
|
12577
|
+
{ latexTrigger: "\\operatorname{count}", parse: "Length" },
|
|
12467
12578
|
{ latexTrigger: "\\operatorname{random}", parse: "Random" },
|
|
12468
12579
|
{ latexTrigger: "\\operatorname{shuffle}", parse: "Shuffle" },
|
|
12469
12580
|
{ latexTrigger: "\\operatorname{repeat}", parse: "Repeat" },
|
|
12470
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.
|
|
12471
12588
|
// ---------------------------------------------------------------------------
|
|
12472
12589
|
// Geometric primitive heads. Registered as known typed heads so consumers
|
|
12473
12590
|
// can branch on the operator name; CE itself doesn't render them. The
|
|
@@ -13746,7 +13863,7 @@ var IntervalArithmetic = {
|
|
|
13746
13863
|
};
|
|
13747
13864
|
|
|
13748
13865
|
// src/interval.ts
|
|
13749
|
-
var version = "0.
|
|
13866
|
+
var version = "0.58.0";
|
|
13750
13867
|
export {
|
|
13751
13868
|
IntervalArithmetic,
|
|
13752
13869
|
_mul,
|