@cortex-js/compute-engine 0.15.0 → 0.17.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/README.md +1 -1
- package/dist/compute-engine.esm.js +7319 -5823
- package/dist/compute-engine.js +7319 -5823
- package/dist/compute-engine.min.esm.js +47 -25822
- package/dist/compute-engine.min.js +19 -25805
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.js +2 -281
- package/dist/types/common/ansi-codes.d.ts +15 -0
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +15 -19
- package/dist/types/compute-engine/boxed-expression/box.d.ts +8 -3
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +9 -9
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +16 -28
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +27 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +9 -21
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +6 -5
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +13 -12
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +21 -15
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +30 -9
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +32 -12
- package/dist/types/compute-engine/compile.d.ts +18 -2
- package/dist/types/compute-engine/compute-engine.d.ts +77 -55
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/domain-utils.d.ts +4 -21
- package/dist/types/compute-engine/function-utils.d.ts +124 -0
- 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-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-inequalities.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-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.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/public.d.ts +31 -13
- 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/library/arithmetic-add.d.ts +2 -2
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +3 -2
- package/dist/types/compute-engine/library/calculus.d.ts +2 -2
- package/dist/types/compute-engine/library/collections.d.ts +2 -2
- package/dist/types/compute-engine/library/complex.d.ts +2 -2
- package/dist/types/compute-engine/library/control-structures.d.ts +2 -0
- package/dist/types/compute-engine/library/core.d.ts +2 -2
- package/dist/types/compute-engine/library/domains.d.ts +9 -9
- package/dist/types/compute-engine/library/library.d.ts +7 -5
- package/dist/types/compute-engine/library/linear-algebra.d.ts +2 -0
- package/dist/types/compute-engine/library/logic.d.ts +2 -2
- package/dist/types/compute-engine/library/polynomials.d.ts +2 -2
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +2 -2
- package/dist/types/compute-engine/library/sets.d.ts +2 -2
- package/dist/types/compute-engine/library/statistics.d.ts +2 -2
- package/dist/types/compute-engine/library/trigonometry.d.ts +2 -2
- package/dist/types/compute-engine/library/utils.d.ts +1 -3
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +3 -2
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +2 -2
- package/dist/types/compute-engine/numerics/numeric.d.ts +61 -3
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
- package/dist/types/compute-engine/public.d.ts +281 -189
- package/dist/types/compute-engine/rules.d.ts +1 -1
- package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/solve.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +20 -0
- package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -2
- package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/sum.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/utils.d.ts +5 -3
- package/dist/types/compute-engine.d.ts +2 -2
- package/dist/types/math-json/math-json-format.d.ts +4 -3
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +2 -2
- package/package.json +25 -22
package/dist/math-json.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS Compute Engine 0.
|
|
1
|
+
/** CortexJS Compute Engine 0.17.0 */
|
|
2
2
|
|
|
3
3
|
// src/math-json/utils.ts
|
|
4
4
|
function isSymbolObject(expr) {
|
|
@@ -239,7 +239,7 @@ function mapArgs(expr, fn) {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
// src/math-json.ts
|
|
242
|
-
var version = "0.
|
|
242
|
+
var version = "0.17.0";
|
|
243
243
|
export {
|
|
244
244
|
applyRecursively,
|
|
245
245
|
dictionary as getDictionary,
|
package/dist/math-json.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS MathJSON 0.
|
|
1
|
+
/** CortexJS MathJSON 0.17.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.MathJson = {}));})(this, (function (exports) { 'use strict';
|
|
3
3
|
var MathJson = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -277,7 +277,7 @@ var MathJson = (() => {
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
// src/math-json.ts
|
|
280
|
-
var version = "0.
|
|
280
|
+
var version = "0.17.0";
|
|
281
281
|
return __toCommonJS(math_json_exports);
|
|
282
282
|
})();
|
|
283
283
|
Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS Compute Engine 0.
|
|
1
|
+
/** CortexJS Compute Engine 0.17.0 */
|
|
2
2
|
|
|
3
3
|
// src/math-json/utils.ts
|
|
4
4
|
function isSymbolObject(expr) {
|
|
@@ -239,7 +239,7 @@ function mapArgs(expr, fn) {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
// src/math-json.ts
|
|
242
|
-
var version = "0.
|
|
242
|
+
var version = "0.17.0";
|
|
243
243
|
export {
|
|
244
244
|
applyRecursively,
|
|
245
245
|
dictionary as getDictionary,
|
package/dist/math-json.min.js
CHANGED
|
@@ -1,283 +1,4 @@
|
|
|
1
|
-
/** CortexJS MathJSON 0.
|
|
1
|
+
/** CortexJS MathJSON 0.17.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.MathJson = {}));})(this, (function (exports) { 'use strict';
|
|
3
|
-
var MathJson = (() => {
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
|
|
22
|
-
// src/math-json.ts
|
|
23
|
-
var math_json_exports = {};
|
|
24
|
-
__export(math_json_exports, {
|
|
25
|
-
applyRecursively: () => applyRecursively,
|
|
26
|
-
getDictionary: () => dictionary,
|
|
27
|
-
getStringValue: () => stringValue,
|
|
28
|
-
head: () => head,
|
|
29
|
-
headName: () => headName,
|
|
30
|
-
isDictionaryObject: () => isDictionaryObject,
|
|
31
|
-
isFunctionObject: () => isFunctionObject,
|
|
32
|
-
isStringObject: () => isStringObject,
|
|
33
|
-
isSymbolObject: () => isSymbolObject,
|
|
34
|
-
mapArgs: () => mapArgs,
|
|
35
|
-
nops: () => nops,
|
|
36
|
-
op: () => op,
|
|
37
|
-
symbol: () => symbol,
|
|
38
|
-
version: () => version
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// src/math-json/utils.ts
|
|
42
|
-
function isSymbolObject(expr) {
|
|
43
|
-
return expr !== null && typeof expr === "object" && "sym" in expr;
|
|
44
|
-
}
|
|
45
|
-
function isStringObject(expr) {
|
|
46
|
-
return expr !== null && typeof expr === "object" && "str" in expr;
|
|
47
|
-
}
|
|
48
|
-
function isFunctionObject(expr) {
|
|
49
|
-
return expr !== null && typeof expr === "object" && "fn" in expr;
|
|
50
|
-
}
|
|
51
|
-
function isDictionaryObject(expr) {
|
|
52
|
-
return expr !== null && typeof expr === "object" && "dict" in expr;
|
|
53
|
-
}
|
|
54
|
-
var recommendedScriptsRegex;
|
|
55
|
-
function isRecommendedScripts(text) {
|
|
56
|
-
if (!recommendedScriptsRegex) {
|
|
57
|
-
const recommendedScripts = [
|
|
58
|
-
"Zyyy",
|
|
59
|
-
"Zinh",
|
|
60
|
-
"Arab",
|
|
61
|
-
"Armn",
|
|
62
|
-
"Beng",
|
|
63
|
-
"Bopo",
|
|
64
|
-
"Cyrl",
|
|
65
|
-
"Deva",
|
|
66
|
-
"Ethi",
|
|
67
|
-
"Geor",
|
|
68
|
-
"Grek",
|
|
69
|
-
"Gujr",
|
|
70
|
-
"Guru",
|
|
71
|
-
"Hang",
|
|
72
|
-
"Hani",
|
|
73
|
-
"Hebr",
|
|
74
|
-
"Hira",
|
|
75
|
-
"Kana",
|
|
76
|
-
"Knda",
|
|
77
|
-
"Khmr",
|
|
78
|
-
"Laoo",
|
|
79
|
-
"Latn",
|
|
80
|
-
"Mlym",
|
|
81
|
-
"Mymr",
|
|
82
|
-
"Orya",
|
|
83
|
-
"Sinh",
|
|
84
|
-
"Taml",
|
|
85
|
-
"Telu",
|
|
86
|
-
"Thaa",
|
|
87
|
-
"Thai",
|
|
88
|
-
"Tibt"
|
|
89
|
-
];
|
|
90
|
-
const regexPattern = `^[${recommendedScripts.map((x) => `\\p{Script=${x}}`).join("")}]*$`;
|
|
91
|
-
recommendedScriptsRegex = new RegExp(regexPattern, "u");
|
|
92
|
-
}
|
|
93
|
-
return recommendedScriptsRegex.test(text);
|
|
94
|
-
}
|
|
95
|
-
function isValidIdentifier(s) {
|
|
96
|
-
if (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s))
|
|
97
|
-
return true;
|
|
98
|
-
if (ONLY_EMOJIS.test(s))
|
|
99
|
-
return true;
|
|
100
|
-
if (!isRecommendedScripts(s))
|
|
101
|
-
return false;
|
|
102
|
-
return /^[\p{XIDS}_]\p{XIDC}*$/u.test(s);
|
|
103
|
-
}
|
|
104
|
-
var VS16 = "\\u{FE0F}";
|
|
105
|
-
var KEYCAP = "\\u{20E3}";
|
|
106
|
-
var ZWJ = "\\u{200D}";
|
|
107
|
-
var FLAG_SEQUENCE = "\\p{RI}\\p{RI}";
|
|
108
|
-
var TAG_MOD = `(?:[\\u{E0020}-\\u{E007E}]+\\u{E007F})`;
|
|
109
|
-
var EMOJI_MOD = `(?:\\p{EMod}|${VS16}${KEYCAP}?|${TAG_MOD})`;
|
|
110
|
-
var EMOJI_NOT_IDENTIFIER = `(?:(?=\\P{XIDC})\\p{Emoji})`;
|
|
111
|
-
var ZWJ_ELEMENT = `(?:${EMOJI_NOT_IDENTIFIER}${EMOJI_MOD}*|\\p{Emoji}${EMOJI_MOD}+|${FLAG_SEQUENCE})`;
|
|
112
|
-
var POSSIBLE_EMOJI = `(?:${ZWJ_ELEMENT})(${ZWJ}${ZWJ_ELEMENT})*`;
|
|
113
|
-
var SOME_EMOJI = new RegExp(`(?:${POSSIBLE_EMOJI})+`, "u");
|
|
114
|
-
var ONLY_EMOJIS = new RegExp(`^(?:${POSSIBLE_EMOJI})+$`, "u");
|
|
115
|
-
function validateIdentifier(s) {
|
|
116
|
-
if (typeof s !== "string")
|
|
117
|
-
return "not-a-string";
|
|
118
|
-
if (s === "")
|
|
119
|
-
return "empty-string";
|
|
120
|
-
if (s.normalize() !== s)
|
|
121
|
-
return "expected-nfc";
|
|
122
|
-
if (/[\u200E\u200F\u2066-\u2069\u202A-\u202E]/.test(s))
|
|
123
|
-
return "unexpected-bidi-marker";
|
|
124
|
-
if (ONLY_EMOJIS.test(s))
|
|
125
|
-
return "valid";
|
|
126
|
-
if (/\p{XIDC}/u.test(s) && SOME_EMOJI.test(s))
|
|
127
|
-
return "unexpected-mixed-emoji";
|
|
128
|
-
if (!isRecommendedScripts(s))
|
|
129
|
-
return "unexpected-script";
|
|
130
|
-
if (!isValidIdentifier(s)) {
|
|
131
|
-
if (!isValidIdentifier(s[0]))
|
|
132
|
-
return "invalid-first-char";
|
|
133
|
-
return "invalid-char";
|
|
134
|
-
}
|
|
135
|
-
return "valid";
|
|
136
|
-
}
|
|
137
|
-
function stringValue(expr) {
|
|
138
|
-
if (expr === null || expr === void 0)
|
|
139
|
-
return null;
|
|
140
|
-
if (typeof expr === "object" && "str" in expr)
|
|
141
|
-
return expr.str;
|
|
142
|
-
if (typeof expr !== "string")
|
|
143
|
-
return null;
|
|
144
|
-
if (expr.length < 2)
|
|
145
|
-
return null;
|
|
146
|
-
if (expr[0] !== "'" || expr[expr.length - 1] !== "'")
|
|
147
|
-
return null;
|
|
148
|
-
return expr.substring(1, expr.length - 1);
|
|
149
|
-
}
|
|
150
|
-
function head(expr) {
|
|
151
|
-
if (expr === null || expr === void 0)
|
|
152
|
-
return null;
|
|
153
|
-
if (Array.isArray(expr)) {
|
|
154
|
-
if (typeof expr[0] === "string" && !isValidIdentifier(expr[0])) {
|
|
155
|
-
console.error(
|
|
156
|
-
`Invalid identifier "${expr[0]}": ${validateIdentifier(expr[0])}`
|
|
157
|
-
);
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
return expr[0];
|
|
161
|
-
}
|
|
162
|
-
if (isFunctionObject(expr))
|
|
163
|
-
return expr.fn[0];
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
|
-
function headName(expr) {
|
|
167
|
-
const h = head(expr);
|
|
168
|
-
return typeof h === "string" ? h : "";
|
|
169
|
-
}
|
|
170
|
-
function ops(expr) {
|
|
171
|
-
if (expr === null || expr === void 0)
|
|
172
|
-
return null;
|
|
173
|
-
if (Array.isArray(expr))
|
|
174
|
-
return expr.slice(1);
|
|
175
|
-
if (isFunctionObject(expr))
|
|
176
|
-
return expr.fn.slice(1);
|
|
177
|
-
return null;
|
|
178
|
-
}
|
|
179
|
-
function op(expr, n) {
|
|
180
|
-
if (expr === null || expr === void 0)
|
|
181
|
-
return null;
|
|
182
|
-
if (Array.isArray(expr))
|
|
183
|
-
return expr[n] ?? null;
|
|
184
|
-
if (isFunctionObject(expr))
|
|
185
|
-
return expr.fn[n] ?? null;
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
|
-
function op1(expr) {
|
|
189
|
-
return op(expr, 1);
|
|
190
|
-
}
|
|
191
|
-
function op2(expr) {
|
|
192
|
-
return op(expr, 2);
|
|
193
|
-
}
|
|
194
|
-
function nops(expr) {
|
|
195
|
-
if (expr === null || expr === void 0)
|
|
196
|
-
return 0;
|
|
197
|
-
if (Array.isArray(expr))
|
|
198
|
-
return Math.max(0, expr.length - 1);
|
|
199
|
-
if (isFunctionObject(expr))
|
|
200
|
-
return Math.max(0, expr.fn.length - 1);
|
|
201
|
-
return 0;
|
|
202
|
-
}
|
|
203
|
-
function symbol(expr) {
|
|
204
|
-
if (expr === null || expr === void 0)
|
|
205
|
-
return null;
|
|
206
|
-
if (typeof expr === "string") {
|
|
207
|
-
if (/^[+\-\.0-9]/.test(expr))
|
|
208
|
-
return null;
|
|
209
|
-
if (expr.length >= 2 && expr[0] === "'" && expr[expr.length - 1] === "'")
|
|
210
|
-
return null;
|
|
211
|
-
}
|
|
212
|
-
const s = isSymbolObject(expr) ? expr.sym : expr;
|
|
213
|
-
if (typeof s !== "string")
|
|
214
|
-
return null;
|
|
215
|
-
return s;
|
|
216
|
-
}
|
|
217
|
-
function keyValuePair(expr) {
|
|
218
|
-
const h = head(expr);
|
|
219
|
-
if (h === "KeyValuePair" || h === "Tuple" || h === "Pair") {
|
|
220
|
-
const key = stringValue(op1(expr));
|
|
221
|
-
if (!key)
|
|
222
|
-
return null;
|
|
223
|
-
return [key, op2(expr) ?? "Nothing"];
|
|
224
|
-
}
|
|
225
|
-
return null;
|
|
226
|
-
}
|
|
227
|
-
function dictionary(expr) {
|
|
228
|
-
if (expr === null)
|
|
229
|
-
return null;
|
|
230
|
-
if (typeof expr === "object" && "dict" in expr)
|
|
231
|
-
return expr.dict;
|
|
232
|
-
const kv = keyValuePair(expr);
|
|
233
|
-
if (kv)
|
|
234
|
-
return { [kv[0]]: kv[1] };
|
|
235
|
-
const h = head(expr);
|
|
236
|
-
if (h === "Dictionary") {
|
|
237
|
-
const result = {};
|
|
238
|
-
for (let i = 1; i < nops(expr); i++) {
|
|
239
|
-
const kv2 = keyValuePair(op(expr, i));
|
|
240
|
-
if (kv2)
|
|
241
|
-
result[kv2[0]] = kv2[1];
|
|
242
|
-
}
|
|
243
|
-
return result;
|
|
244
|
-
}
|
|
245
|
-
return null;
|
|
246
|
-
}
|
|
247
|
-
function applyRecursively(expr, fn) {
|
|
248
|
-
const h = head(expr);
|
|
249
|
-
if (h !== null) {
|
|
250
|
-
return [fn(h), ...(ops(expr) ?? []).map(fn)];
|
|
251
|
-
}
|
|
252
|
-
const dict = dictionary(expr);
|
|
253
|
-
if (dict !== null) {
|
|
254
|
-
const keys = Object.keys(dict);
|
|
255
|
-
const result = {};
|
|
256
|
-
for (const key of keys)
|
|
257
|
-
result[key] = fn(dict[key]);
|
|
258
|
-
return { dict: result };
|
|
259
|
-
}
|
|
260
|
-
return fn(expr);
|
|
261
|
-
}
|
|
262
|
-
function mapArgs(expr, fn) {
|
|
263
|
-
let args = null;
|
|
264
|
-
if (Array.isArray(expr))
|
|
265
|
-
args = expr;
|
|
266
|
-
if (isFunctionObject(expr))
|
|
267
|
-
args = expr.fn;
|
|
268
|
-
if (args === null)
|
|
269
|
-
return [];
|
|
270
|
-
let i = 1;
|
|
271
|
-
const result = [];
|
|
272
|
-
while (i < args.length) {
|
|
273
|
-
result.push(fn(args[i]));
|
|
274
|
-
i += 1;
|
|
275
|
-
}
|
|
276
|
-
return result;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// src/math-json.ts
|
|
280
|
-
var version = "0.15.0";
|
|
281
|
-
return __toCommonJS(math_json_exports);
|
|
282
|
-
})();
|
|
3
|
+
var MathJson=(()=>{var f=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var D=(n,t)=>{for(var e in t)f(n,e,{get:t[e],enumerable:!0})},R=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of k(t))!v.call(n,r)&&r!==e&&f(n,r,{get:()=>t[r],enumerable:!(i=J(t,r))||i.enumerable});return n};var _=n=>R(f({},"__esModule",{value:!0}),n);var z={};D(z,{applyRecursively:()=>T,getDictionary:()=>y,getStringValue:()=>m,head:()=>o,headName:()=>I,isDictionaryObject:()=>M,isFunctionObject:()=>u,isStringObject:()=>S,isSymbolObject:()=>d,mapArgs:()=>$,nops:()=>E,op:()=>s,symbol:()=>A,version:()=>X});function d(n){return n!==null&&typeof n=="object"&&"sym"in n}function S(n){return n!==null&&typeof n=="object"&&"str"in n}function u(n){return n!==null&&typeof n=="object"&&"fn"in n}function M(n){return n!==null&&typeof n=="object"&&"dict"in n}var c;function N(n){if(!c){let e=`^[${["Zyyy","Zinh","Arab","Armn","Beng","Bopo","Cyrl","Deva","Ethi","Geor","Grek","Gujr","Guru","Hang","Hani","Hebr","Hira","Kana","Knda","Khmr","Laoo","Latn","Mlym","Mymr","Orya","Sinh","Taml","Telu","Thaa","Thai","Tibt"].map(i=>`\\p{Script=${i}}`).join("")}]*$`;c=new RegExp(e,"u")}return c.test(n)}function a(n){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||O.test(n)?!0:N(n)?/^[\p{XIDS}_]\p{XIDC}*$/u.test(n):!1}var F="\\u{FE0F}",L="\\u{20E3}",w="\\u{200D}",V="\\p{RI}\\p{RI}",P="(?:[\\u{E0020}-\\u{E007E}]+\\u{E007F})",b=`(?:\\p{EMod}|${F}${L}?|${P})`,q="(?:(?=\\P{XIDC})\\p{Emoji})",h=`(?:${q}${b}*|\\p{Emoji}${b}+|${V})`,j=`(?:${h})(${w}${h})*`,C=new RegExp(`(?:${j})+`,"u"),O=new RegExp(`^(?:${j})+$`,"u");function G(n){return typeof n!="string"?"not-a-string":n===""?"empty-string":n.normalize()!==n?"expected-nfc":/[\u200E\u200F\u2066-\u2069\u202A-\u202E]/.test(n)?"unexpected-bidi-marker":O.test(n)?"valid":/\p{XIDC}/u.test(n)&&C.test(n)?"unexpected-mixed-emoji":N(n)?a(n)?"valid":a(n[0])?"invalid-char":"invalid-first-char":"unexpected-script"}function m(n){return n==null?null:typeof n=="object"&&"str"in n?n.str:typeof n!="string"||n.length<2||n[0]!=="'"||n[n.length-1]!=="'"?null:n.substring(1,n.length-1)}function o(n){return n==null?null:Array.isArray(n)?typeof n[0]=="string"&&!a(n[0])?(console.error(`Invalid identifier "${n[0]}": ${G(n[0])}`),null):n[0]:u(n)?n.fn[0]:null}function I(n){let t=o(n);return typeof t=="string"?t:""}function K(n){return n==null?null:Array.isArray(n)?n.slice(1):u(n)?n.fn.slice(1):null}function s(n,t){return n==null?null:Array.isArray(n)?n[t]??null:u(n)?n.fn[t]??null:null}function Z(n){return s(n,1)}function H(n){return s(n,2)}function E(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):u(n)?Math.max(0,n.fn.length-1):0}function A(n){if(n==null||typeof n=="string"&&(/^[+\-\.0-9]/.test(n)||n.length>=2&&n[0]==="'"&&n[n.length-1]==="'"))return null;let t=d(n)?n.sym:n;return typeof t!="string"?null:t}function p(n){let t=o(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let e=m(Z(n));return e?[e,H(n)??"Nothing"]:null}return null}function y(n){if(n===null)return null;if(typeof n=="object"&&"dict"in n)return n.dict;let t=p(n);if(t)return{[t[0]]:t[1]};if(o(n)==="Dictionary"){let i={};for(let r=1;r<E(n);r++){let l=p(s(n,r));l&&(i[l[0]]=l[1])}return i}return null}function T(n,t){let e=o(n);if(e!==null)return[t(e),...(K(n)??[]).map(t)];let i=y(n);if(i!==null){let r=Object.keys(i),l={};for(let g of r)l[g]=t(i[g]);return{dict:l}}return t(n)}function $(n,t){let e=null;if(Array.isArray(n)&&(e=n),u(n)&&(e=n.fn),e===null)return[];let i=1,r=[];for(;i<e.length;)r.push(t(e[i])),i+=1;return r}var X="0.17.0";return _(z);})();
|
|
283
4
|
Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* 0.17.0 */
|
|
2
|
+
export declare const BLACK = "\u001B[30;1m${s}";
|
|
3
|
+
export declare const GREY = "\u001B[30;1m${s}";
|
|
4
|
+
export declare const GREEN = "\u001B[32;1m";
|
|
5
|
+
export declare const RED = "\u001B[31;1m";
|
|
6
|
+
export declare const YELLOW = "\u001B[33m";
|
|
7
|
+
export declare const BLUE = "\u001B[34;1m";
|
|
8
|
+
export declare const MAGENTA = "\u001B[35;1m";
|
|
9
|
+
export declare const CYAN = "\u001B[36;1m";
|
|
10
|
+
export declare const INVERSE_RED = "\u001B[101;97m";
|
|
11
|
+
export declare const INVERSE_GREEN = "\u001B[102;97m";
|
|
12
|
+
export declare const INVERSE_YELLOW = "\u001B[103;97m";
|
|
13
|
+
export declare const INVERSE_BLUE = "\u001B[104;97m";
|
|
14
|
+
export declare const BOLD = "\u001B[1m";
|
|
15
|
+
export declare const GREY_BG = "\u001B[40;1m";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.17.0 */
|
|
2
2
|
export type SignalCode = RuntimeSignalCode | ('invalid-name' | 'expected-predicate' | 'expected-symbol' | 'operator-requires-one-operand' | 'postfix-operator-requires-one-operand' | 'prefix-operator-requires-one-operand' | 'unbalanced-symbols' | 'expected-argument' | 'unexpected-command' | 'cyclic-definition' | 'invalid-supersets' | 'expected-supersets' | 'unknown-domain' | 'duplicate-wikidata' | 'invalid-dictionary-entry' | 'syntax-error');
|
|
3
3
|
export type SignalMessage = SignalCode | [SignalCode, ...any[]];
|
|
4
4
|
export type SignalOrigin = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.17.0 */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.17.0 */
|
|
2
2
|
/**
|
|
3
3
|
* Add an assumption, in the form of a predicate, for example:
|
|
4
4
|
*
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Some assumptions are handled separately, specifically, those that can
|
|
11
11
|
* be represented as a symbol definition (equality to an expression,
|
|
12
|
-
* membership to
|
|
12
|
+
* membership to Integers, RealNumbers, etc..., >0, <=0, etc...). The result
|
|
13
13
|
* of these are stored directly in the current scope's symbols dictionary
|
|
14
14
|
* (and an entry for the symbol is created if necessary).
|
|
15
15
|
*
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import {
|
|
1
|
+
/* 0.17.0 */
|
|
2
|
+
import type { Decimal } from 'decimal.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
|
-
import { BoxedExpression, BoxedFunctionDefinition, BoxedRuleSet, BoxedSymbolDefinition, BoxedDomain, EvaluateOptions, IComputeEngine, LatexString, Metadata, NOptions, PatternMatchOptions,
|
|
4
|
+
import { BoxedExpression, BoxedFunctionDefinition, BoxedRuleSet, BoxedSymbolDefinition, BoxedDomain, EvaluateOptions, IComputeEngine, LatexString, Metadata, NOptions, PatternMatchOptions, SimplifyOptions, Substitution, RuntimeScope, DomainCompatibility, DomainLiteral, BoxedBaseDefinition, Rational, BoxedSubstitution } from '../public';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* _BoxedExpression
|
|
7
7
|
*/
|
|
8
|
-
export declare abstract class
|
|
8
|
+
export declare abstract class _BoxedExpression implements BoxedExpression {
|
|
9
9
|
abstract readonly hash: number;
|
|
10
10
|
abstract readonly json: Expression;
|
|
11
11
|
abstract readonly head: BoxedExpression | string;
|
|
@@ -15,11 +15,10 @@ export declare abstract class AbstractBoxedExpression implements BoxedExpression
|
|
|
15
15
|
abstract isEqual(rhs: BoxedExpression): boolean;
|
|
16
16
|
abstract match(rhs: BoxedExpression, options?: PatternMatchOptions): BoxedSubstitution | null;
|
|
17
17
|
readonly engine: IComputeEngine;
|
|
18
|
-
/** Verbatim LaTeX, obtained from a source, i.e. from parsing,
|
|
19
|
-
* synthetically
|
|
18
|
+
/** Verbatim LaTeX, obtained from a source, i.e. from parsing,
|
|
19
|
+
* not generated synthetically
|
|
20
20
|
*/
|
|
21
21
|
protected _latex?: string;
|
|
22
|
-
protected _wikidata: string | undefined;
|
|
23
22
|
constructor(ce: IComputeEngine, metadata?: Metadata);
|
|
24
23
|
/** `Object.valueOf()`: return a primitive value for the object
|
|
25
24
|
*
|
|
@@ -43,7 +42,8 @@ export declare abstract class AbstractBoxedExpression implements BoxedExpression
|
|
|
43
42
|
getSubexpressions(head: string): BoxedExpression[];
|
|
44
43
|
get subexpressions(): BoxedExpression[];
|
|
45
44
|
get symbols(): string[];
|
|
46
|
-
get
|
|
45
|
+
get unknowns(): string[];
|
|
46
|
+
get freeVariables(): string[];
|
|
47
47
|
get errors(): BoxedExpression[];
|
|
48
48
|
get ops(): null | BoxedExpression[];
|
|
49
49
|
get nops(): number;
|
|
@@ -53,12 +53,9 @@ export declare abstract class AbstractBoxedExpression implements BoxedExpression
|
|
|
53
53
|
get isValid(): boolean;
|
|
54
54
|
get isPure(): boolean;
|
|
55
55
|
get isExact(): boolean;
|
|
56
|
-
/** For a symbol, true if the symbol is a free variable (no value) */
|
|
57
|
-
get isFree(): boolean;
|
|
58
56
|
/** For a symbol, true if the symbol is a constant (unchangeable value) */
|
|
59
57
|
get isConstant(): boolean;
|
|
60
58
|
get canonical(): BoxedExpression;
|
|
61
|
-
apply(_fn: (x: BoxedExpression) => SemiBoxedExpression, _head?: string): BoxedExpression;
|
|
62
59
|
subs(_sub: Substitution, options?: {
|
|
63
60
|
canonical: boolean;
|
|
64
61
|
}): BoxedExpression;
|
|
@@ -90,22 +87,21 @@ export declare abstract class AbstractBoxedExpression implements BoxedExpression
|
|
|
90
87
|
get description(): string[] | undefined;
|
|
91
88
|
get url(): string | undefined;
|
|
92
89
|
get wikidata(): string | undefined;
|
|
93
|
-
set wikidata(val: string | undefined);
|
|
94
90
|
get complexity(): number | undefined;
|
|
95
|
-
get
|
|
91
|
+
get baseDefinition(): BoxedBaseDefinition | undefined;
|
|
96
92
|
get symbolDefinition(): BoxedSymbolDefinition | undefined;
|
|
97
93
|
get functionDefinition(): BoxedFunctionDefinition | undefined;
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
infer(_domain: BoxedDomain): boolean;
|
|
95
|
+
bind(): void;
|
|
96
|
+
reset(): void;
|
|
100
97
|
get keys(): IterableIterator<string> | null;
|
|
101
98
|
get keysCount(): number;
|
|
102
99
|
getKey(_key: string): BoxedExpression | undefined;
|
|
103
100
|
hasKey(_key: string): boolean;
|
|
104
101
|
get value(): BoxedExpression | undefined;
|
|
105
102
|
set value(_value: BoxedExpression | number | undefined);
|
|
106
|
-
get domain(): BoxedDomain;
|
|
103
|
+
get domain(): BoxedDomain | undefined;
|
|
107
104
|
set domain(_domain: BoxedDomain);
|
|
108
|
-
get explicitDomain(): BoxedDomain | undefined;
|
|
109
105
|
get isNumber(): boolean | undefined;
|
|
110
106
|
get isInteger(): boolean | undefined;
|
|
111
107
|
get isRational(): boolean | undefined;
|
|
@@ -116,7 +112,7 @@ export declare abstract class AbstractBoxedExpression implements BoxedExpression
|
|
|
116
112
|
get isImaginary(): boolean | undefined;
|
|
117
113
|
get isExtendedComplex(): boolean | undefined;
|
|
118
114
|
simplify(_options?: SimplifyOptions): BoxedExpression;
|
|
119
|
-
evaluate(
|
|
115
|
+
evaluate(_options?: EvaluateOptions): BoxedExpression;
|
|
120
116
|
N(_options?: NOptions): BoxedExpression;
|
|
121
117
|
compile(to?: string, options?: {
|
|
122
118
|
optimize: ('simplify' | 'evaluate')[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.17.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { IComputeEngine, SemiBoxedExpression, BoxedExpression, Metadata, Rational } from '../public';
|
|
4
4
|
import { MathJsonNumber } from '../../math-json/math-json-format';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* ## THEORY OF OPERATIONS
|
|
7
7
|
*
|
|
8
8
|
* 1/ Boxing does not depend on the numeric mode. The numeric mode could be
|
|
9
9
|
* changed later, but the previously boxed numbers could not be retroactively
|
|
@@ -20,7 +20,12 @@ import { MathJsonNumber } from '../../math-json/math-json-format';
|
|
|
20
20
|
* which is canonical from the start avoid going through an intermediary step
|
|
21
21
|
* with a non-canonical expression.
|
|
22
22
|
*
|
|
23
|
-
* 3/ When
|
|
23
|
+
* 3/ When boxing (and canonicalizing), if the function is "scoped", a new
|
|
24
|
+
* scope is created before the canonicalization, so that any declaration
|
|
25
|
+
* are done within that scope. Example of scoped functions include `Block`
|
|
26
|
+
* and `Sum`.
|
|
27
|
+
*
|
|
28
|
+
* 4/ When implementing an `evaluate()`:
|
|
24
29
|
* - if `bignumPreferred()` all operations should be done in bignum and complex,
|
|
25
30
|
* otherwise, they should all be done in machine numbers and complex.
|
|
26
31
|
* - if not `complexAllowed()`, return `NaN` if a complex value is encountered
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.17.0 */
|
|
2
2
|
import { BoxedExpression, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, ReplaceOptions, Substitution, Metadata, PatternMatchOptions, BoxedDomain, BoxedSubstitution } from '../public';
|
|
3
|
-
import {
|
|
3
|
+
import { _BoxedExpression } from './abstract-boxed-expression';
|
|
4
4
|
/**
|
|
5
5
|
* BoxedDictionary
|
|
6
6
|
*/
|
|
7
|
-
export declare class BoxedDictionary extends
|
|
7
|
+
export declare class BoxedDictionary extends _BoxedExpression {
|
|
8
8
|
private _value;
|
|
9
9
|
private _isCanonical;
|
|
10
10
|
constructor(ce: IComputeEngine, dict: {
|
|
11
11
|
[key: string]: SemiBoxedExpression;
|
|
12
|
-
}, options?: {
|
|
12
|
+
} | Map<string, BoxedExpression>, options?: {
|
|
13
13
|
canonical?: boolean;
|
|
14
14
|
metadata?: Metadata;
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
bind(): void;
|
|
17
|
+
reset(): undefined;
|
|
17
18
|
get hash(): number;
|
|
18
19
|
get complexity(): number;
|
|
19
20
|
get head(): 'Dictionary';
|
|
@@ -30,13 +31,12 @@ export declare class BoxedDictionary extends AbstractBoxedExpression {
|
|
|
30
31
|
match(rhs: BoxedExpression, _options?: PatternMatchOptions): BoxedSubstitution | null;
|
|
31
32
|
/** Mathematical equality */
|
|
32
33
|
isEqual(rhs: BoxedExpression): boolean;
|
|
33
|
-
|
|
34
|
-
evaluate(options?: EvaluateOptions): BoxedExpression;
|
|
34
|
+
evaluate(_options?: EvaluateOptions): BoxedExpression;
|
|
35
35
|
get isCanonical(): boolean;
|
|
36
36
|
set isCanonical(val: boolean);
|
|
37
37
|
get canonical(): BoxedExpression;
|
|
38
|
-
simplify(
|
|
39
|
-
N(
|
|
38
|
+
simplify(_options?: SimplifyOptions): BoxedExpression;
|
|
39
|
+
N(_options?: NOptions): BoxedExpression;
|
|
40
40
|
replace(rules: BoxedRuleSet, options?: ReplaceOptions): null | BoxedExpression;
|
|
41
41
|
subs(sub: Substitution, options?: {
|
|
42
42
|
canonical: boolean;
|
|
@@ -1,51 +1,39 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.17.0 */
|
|
2
2
|
import { BoxedDomain, BoxedExpression, BoxedSubstitution, DomainCompatibility, DomainConstructor, DomainExpression, DomainLiteral, IComputeEngine, Metadata, PatternMatchOptions } from '../public';
|
|
3
|
-
import {
|
|
3
|
+
import { _BoxedExpression } from './abstract-boxed-expression';
|
|
4
4
|
/**
|
|
5
|
-
* A `_BoxedDomain` is a wrapper around a boxed, canonical, domain
|
|
5
|
+
* A `_BoxedDomain` is a wrapper around a boxed, canonical, domain
|
|
6
|
+
* expression.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
+
* It could be an invalid domain, in which case `isValid` is `false`.
|
|
8
9
|
*
|
|
9
10
|
*/
|
|
10
|
-
export declare class _BoxedDomain extends
|
|
11
|
-
/** The value of a boxed domain is either a string if a domain literal, or a
|
|
12
|
-
* domain constructor function.
|
|
13
|
-
* Since the domains are alway canonicalized when boxed, their value can
|
|
14
|
-
* be represented by a simple array, without the need for extra boxing.
|
|
15
|
-
*/
|
|
16
|
-
_value: DomainExpression<BoxedExpression>;
|
|
11
|
+
export declare class _BoxedDomain extends _BoxedExpression implements BoxedDomain {
|
|
17
12
|
private _hash;
|
|
13
|
+
readonly base: DomainLiteral;
|
|
14
|
+
readonly ctor: DomainConstructor | null;
|
|
15
|
+
readonly params: BoxedDomain[];
|
|
16
|
+
readonly optParams: BoxedDomain[];
|
|
17
|
+
readonly restParam: BoxedDomain | null;
|
|
18
|
+
readonly result: BoxedDomain | null;
|
|
18
19
|
constructor(ce: IComputeEngine, dom: DomainExpression, metadata?: Metadata);
|
|
19
|
-
get isCanonical(): boolean;
|
|
20
20
|
/** Boxed domains are always canonical. */
|
|
21
|
+
get isCanonical(): boolean;
|
|
21
22
|
get canonical(): _BoxedDomain;
|
|
22
23
|
get isValid(): boolean;
|
|
23
24
|
get json(): Expression;
|
|
24
|
-
get literal(): string | null;
|
|
25
|
-
get ctor(): DomainConstructor | null;
|
|
26
|
-
get domainArgs(): (string | BoxedExpression | DomainExpression<BoxedExpression>)[] | null;
|
|
27
|
-
get domainArg1(): string | BoxedExpression | DomainExpression<BoxedExpression> | null;
|
|
28
|
-
get codomain(): BoxedDomain | null;
|
|
29
25
|
get hash(): number;
|
|
26
|
+
isCompatible(dom: BoxedDomain | DomainLiteral, compatibility?: DomainCompatibility): boolean;
|
|
30
27
|
isEqual(rhs: BoxedExpression): boolean;
|
|
31
28
|
isSame(rhs: BoxedExpression): boolean;
|
|
32
|
-
is(rhs: any): boolean;
|
|
33
|
-
isCompatible(dom: BoxedDomain | DomainLiteral, compatibility?: DomainCompatibility): boolean;
|
|
34
29
|
match(rhs: BoxedExpression, _options?: PatternMatchOptions): BoxedSubstitution | null;
|
|
35
30
|
get head(): string;
|
|
36
31
|
get domain(): BoxedDomain;
|
|
37
|
-
get isNothing(): boolean;
|
|
38
32
|
get isFunction(): boolean;
|
|
39
33
|
get isNumeric(): boolean;
|
|
40
|
-
get isRelationalOperator(): boolean;
|
|
41
34
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Note that `boxDomain()` should only be called from `ComputeEngine`.
|
|
44
|
-
* This gives a chance for `ComputeEngine` to substitute cached objects.
|
|
45
|
-
*/
|
|
46
|
-
export declare function boxDomain(ce: IComputeEngine, dom: BoxedExpression | DomainExpression, metadata?: Metadata): BoxedDomain;
|
|
47
35
|
/** Validate that `expr` is a Domain */
|
|
48
36
|
export declare function isDomain(expr: Expression | BoxedExpression | BoxedDomain | DomainExpression): expr is BoxedDomain | DomainExpression;
|
|
49
|
-
export declare function isValidDomain(expr: any): expr is BoxedDomain | DomainExpression;
|
|
50
37
|
/** Return the ancestor domain that is shared by both `a` and `b` */
|
|
51
|
-
export declare function
|
|
38
|
+
export declare function widen(a: BoxedDomain | undefined | null, b: BoxedDomain | undefined | null): BoxedDomain | undefined;
|
|
39
|
+
export declare function narrow(a: BoxedDomain | undefined, b: BoxedDomain | undefined): BoxedDomain;
|
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.17.0 */
|
|
2
|
+
export declare class _BoxedFunctionDefinition implements BoxedFunctionDefinition {
|
|
3
|
+
engine: IComputeEngine;
|
|
4
|
+
scope: RuntimeScope;
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string | string[];
|
|
7
|
+
wikidata?: string;
|
|
8
|
+
threadable: boolean;
|
|
9
|
+
associative: boolean;
|
|
10
|
+
commutative: boolean;
|
|
11
|
+
idempotent: boolean;
|
|
12
|
+
involution: boolean;
|
|
13
|
+
pure: boolean;
|
|
14
|
+
inert: boolean;
|
|
15
|
+
numeric: boolean;
|
|
16
|
+
complexity: number;
|
|
17
|
+
hold: Hold;
|
|
18
|
+
dynamic: boolean;
|
|
19
|
+
signature: BoxedFunctionSignature;
|
|
20
|
+
iterator?: (expr: BoxedExpression, start?: number, count?: number) => Iterator<BoxedExpression>;
|
|
21
|
+
at?: (expr: BoxedExpression, index: number | string) => undefined | BoxedExpression;
|
|
22
|
+
size?: (expr: BoxedExpression) => number;
|
|
23
|
+
keys?: (expr: BoxedExpression) => undefined | Iterator<string>;
|
|
24
|
+
indexOf?: (expr: BoxedExpression, target: BoxedExpression, from?: number) => number | string | undefined;
|
|
25
|
+
constructor(ce: IComputeEngine, name: string, def: FunctionDefinition);
|
|
26
|
+
reset(): void;
|
|
27
|
+
}
|
|
2
28
|
export declare function makeFunctionDefinition(engine: IComputeEngine, name: string, def: FunctionDefinition | BoxedFunctionDefinition): BoxedFunctionDefinition;
|