@cortex-js/compute-engine 0.5.0 → 0.7.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/compute-engine.esm.js +16900 -13123
- package/dist/compute-engine.min.esm.js +2 -2
- package/dist/compute-engine.min.js +2 -2
- package/dist/math-json.esm.js +90 -36
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.js +2 -2
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/signals.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 +23 -10
- package/dist/types/compute-engine/boxed-expression/box.d.ts +4 -18
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +49 -6
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +14 -11
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +5 -5
- 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 +10 -7
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +24 -10
- 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 +1 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +25 -8
- package/dist/types/compute-engine/compute-engine.d.ts +73 -47
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/domain-utils.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-core.d.ts +1 -3
- 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-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 +8 -8
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +3 -3
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +89 -63
- package/dist/types/compute-engine/latex-syntax/public.d.ts +85 -67
- 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 +6 -4
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-add.d.ts +11 -0
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +15 -0
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +19 -0
- package/dist/types/compute-engine/{dictionary → library}/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +2 -0
- package/dist/types/compute-engine/library/calculus.d.ts +2 -0
- package/dist/types/compute-engine/library/collections.d.ts +2 -0
- package/dist/types/compute-engine/library/core.d.ts +2 -0
- package/dist/types/compute-engine/library/domains.d.ts +15 -0
- package/dist/types/compute-engine/library/library.d.ts +17 -0
- package/dist/types/compute-engine/library/logic.d.ts +2 -0
- package/dist/types/compute-engine/library/polynomials.d.ts +2 -0
- package/dist/types/compute-engine/library/relational-operator.d.ts +2 -0
- package/dist/types/compute-engine/library/sets.d.ts +2 -0
- package/dist/types/compute-engine/library/trigonometry.d.ts +2 -0
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-decimal.d.ts +5 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +4 -2
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/public.d.ts +265 -219
- 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/symbolic/expand.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -1
- 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 +2 -2
- package/dist/types/compute-engine/symbolic/utils.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +3 -2
- package/dist/types/math-json/math-json-format.d.ts +27 -23
- package/dist/types/math-json/utils.d.ts +23 -18
- package/dist/types/math-json.d.ts +3 -3
- package/package.json +21 -22
- package/dist/types/compute-engine/dictionary/arithmetic-add.d.ts +0 -11
- package/dist/types/compute-engine/dictionary/arithmetic-divide.d.ts +0 -9
- package/dist/types/compute-engine/dictionary/arithmetic-multiply.d.ts +0 -17
- package/dist/types/compute-engine/dictionary/arithmetic.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/collections.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/core.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/dictionary.d.ts +0 -26
- package/dist/types/compute-engine/dictionary/logic.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/polynomials.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/relational-operator.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/sets.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/trigonometry.d.ts +0 -2
package/dist/math-json.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** MathJSON 0.
|
|
1
|
+
/** MathJSON 0.7.0 */
|
|
2
2
|
/**
|
|
3
3
|
* These constants are the 'primitive' functions and constants that are used
|
|
4
4
|
* for some basic manipulations such as parsing, and transforming to canonical
|
|
@@ -32,7 +32,7 @@ function isAtomic(expr) {
|
|
|
32
32
|
* **U+0027 APOSTROPHE** : **`'`** or an object literal with a `str` key.
|
|
33
33
|
*/
|
|
34
34
|
function stringValue(expr) {
|
|
35
|
-
if (expr === null)
|
|
35
|
+
if (expr === null || expr === undefined)
|
|
36
36
|
return null;
|
|
37
37
|
if (typeof expr === 'object' && 'str' in expr)
|
|
38
38
|
return expr.str;
|
|
@@ -54,7 +54,7 @@ function stringValue(expr) {
|
|
|
54
54
|
* * `[["Prime", "f"], "x"]` -> `["Prime", "f"]`
|
|
55
55
|
*/
|
|
56
56
|
function head(expr) {
|
|
57
|
-
if (expr === null)
|
|
57
|
+
if (expr === null || expr === undefined)
|
|
58
58
|
return null;
|
|
59
59
|
if (Array.isArray(expr))
|
|
60
60
|
return expr[0];
|
|
@@ -68,7 +68,7 @@ function headName(expr) {
|
|
|
68
68
|
return typeof h === 'string' ? h : '';
|
|
69
69
|
}
|
|
70
70
|
function op(expr, n) {
|
|
71
|
-
if (expr === null)
|
|
71
|
+
if (expr === null || expr === undefined)
|
|
72
72
|
return null;
|
|
73
73
|
if (Array.isArray(expr))
|
|
74
74
|
return expr[n] ?? null;
|
|
@@ -76,46 +76,73 @@ function op(expr, n) {
|
|
|
76
76
|
return expr.fn[n] ?? null;
|
|
77
77
|
return null;
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Return all the elements but the first one, i.e. the arguments of a
|
|
81
|
+
* function.
|
|
82
|
+
*/
|
|
83
|
+
function ops(expr) {
|
|
84
|
+
if (expr === null || expr === undefined)
|
|
85
|
+
return null;
|
|
86
|
+
if (Array.isArray(expr))
|
|
87
|
+
return expr.slice(1);
|
|
88
|
+
if (isFunctionObject(expr))
|
|
89
|
+
return expr.fn.slice(1);
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
79
92
|
function nops(expr) {
|
|
80
|
-
if (
|
|
93
|
+
if (expr === null || expr === undefined)
|
|
94
|
+
return 0;
|
|
95
|
+
if (Array.isArray(expr))
|
|
81
96
|
return Math.max(0, expr.length - 1);
|
|
82
|
-
|
|
83
|
-
if (isFunctionObject(expr)) {
|
|
97
|
+
if (isFunctionObject(expr))
|
|
84
98
|
return Math.max(0, expr.fn.length - 1);
|
|
85
|
-
}
|
|
86
99
|
return 0;
|
|
87
100
|
}
|
|
88
101
|
function symbol(expr) {
|
|
89
|
-
if (expr === null)
|
|
102
|
+
if (expr === null || expr === undefined)
|
|
103
|
+
return null;
|
|
104
|
+
const s = isSymbolObject(expr) ? expr.sym : expr;
|
|
105
|
+
if (typeof s !== 'string')
|
|
106
|
+
return null;
|
|
107
|
+
// Is it a string literal?
|
|
108
|
+
if (s.length >= 2 && s[0] === "'" && s[s.length - 1] === "'")
|
|
90
109
|
return null;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
110
|
+
return s;
|
|
111
|
+
}
|
|
112
|
+
function keyValuePair(expr) {
|
|
113
|
+
const h = head(expr);
|
|
114
|
+
if (h === 'KeyValuePair' || h === 'Tuple' || h === 'Pair') {
|
|
115
|
+
const key = stringValue(op(expr, 1));
|
|
116
|
+
if (!key)
|
|
94
117
|
return null;
|
|
95
|
-
|
|
96
|
-
return expr;
|
|
118
|
+
return [key, op(expr, 2) ?? 'Nothing'];
|
|
97
119
|
}
|
|
98
|
-
if (isSymbolObject(expr))
|
|
99
|
-
return expr.sym;
|
|
100
120
|
return null;
|
|
101
121
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
122
|
+
function dictionary(expr) {
|
|
123
|
+
if (expr === null)
|
|
124
|
+
return null;
|
|
125
|
+
if (typeof expr === 'object' && 'dict' in expr)
|
|
126
|
+
return expr.dict;
|
|
127
|
+
const kv = keyValuePair(expr);
|
|
128
|
+
if (kv)
|
|
129
|
+
return { [kv[0]]: kv[1] };
|
|
130
|
+
const h = head(expr);
|
|
131
|
+
if (h === 'Dictionary') {
|
|
132
|
+
const result = {};
|
|
133
|
+
for (let i = 1; i < nops(expr); i++) {
|
|
134
|
+
const kv = keyValuePair(op(expr, i));
|
|
135
|
+
if (kv)
|
|
136
|
+
result[kv[0]] = kv[1];
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
112
139
|
}
|
|
113
|
-
return
|
|
140
|
+
return null;
|
|
114
141
|
}
|
|
115
142
|
function applyRecursively(expr, fn) {
|
|
116
143
|
const h = head(expr);
|
|
117
144
|
if (h !== null) {
|
|
118
|
-
return [fn(h), ...
|
|
145
|
+
return [fn(h), ...(ops(expr) ?? []).map(fn)];
|
|
119
146
|
}
|
|
120
147
|
const dict = dictionary(expr);
|
|
121
148
|
if (dict !== null) {
|
|
@@ -146,11 +173,6 @@ function mapArgs(expr, fn) {
|
|
|
146
173
|
}
|
|
147
174
|
return result;
|
|
148
175
|
}
|
|
149
|
-
function dictionary(expr) {
|
|
150
|
-
if (typeof expr === 'object' && 'dict' in expr)
|
|
151
|
-
return expr.dict;
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
176
|
/**
|
|
155
177
|
* Return num as a number if it's a valid JSON number (that is
|
|
156
178
|
* a valid JavaScript number but not NaN or +/-Infinity) or
|
|
@@ -172,9 +194,41 @@ function asValidJSONNumber(num) {
|
|
|
172
194
|
}
|
|
173
195
|
}
|
|
174
196
|
return num;
|
|
175
|
-
}
|
|
197
|
+
}
|
|
198
|
+
// function number(
|
|
199
|
+
// expr: Expression | null | undefined
|
|
200
|
+
// ): number | string | null {
|
|
201
|
+
// if (expr === null || expr === undefined) return null;
|
|
202
|
+
// if (typeof expr === 'number') return expr;
|
|
203
|
+
// if (isNumberObject(expr)) return expr.num;
|
|
204
|
+
// return null;
|
|
205
|
+
// }
|
|
206
|
+
// export function isEqual(lhs: Expression, rhs: Expression): boolean {
|
|
207
|
+
// const symbLhs = symbol(lhs);
|
|
208
|
+
// if (symbLhs) return symbLhs === symbol(rhs);
|
|
209
|
+
// const strLhs = string(lhs);
|
|
210
|
+
// if (strLhs) return strLhs === string(rhs);
|
|
211
|
+
// if (Array.isArray(lhs) || isFunctionObject(lhs)) {
|
|
212
|
+
// if (!(Array.isArray(rhs) || isFunctionObject(rhs))) return false;
|
|
213
|
+
// if (nops(lhs) !== nops(rhs)) return false;
|
|
214
|
+
// if (!isEqual(head(lhs)!, head(rhs)!)) return false;
|
|
215
|
+
// const lhsTail = tail(lhs);
|
|
216
|
+
// const rhsTail = tail(rhs);
|
|
217
|
+
// for (let i = 0; i <= nops(lhs); i += 1)
|
|
218
|
+
// if (!isEqual(lhsTail[i], rhsTail[i])) return false;
|
|
219
|
+
// return true;
|
|
220
|
+
// }
|
|
221
|
+
// if (typeof lhs === 'number' || isNumberObject(lhs)) {
|
|
222
|
+
// if (!(typeof rhs === 'number' || isNumberObject(rhs))) return false;
|
|
223
|
+
// const mLhs = number(lhs);
|
|
224
|
+
// const mRhs = number(rhs);
|
|
225
|
+
// if (mLhs !== null) return mLhs === mRhs;
|
|
226
|
+
// return false;
|
|
227
|
+
// }
|
|
228
|
+
// return false;
|
|
229
|
+
// }
|
|
176
230
|
|
|
177
231
|
// This is the root of the `math-json` package (i.e. `math-json.js` and
|
|
178
|
-
const version = '0.
|
|
232
|
+
const version = '0.7.0';
|
|
179
233
|
|
|
180
|
-
export { applyRecursively, asValidJSONNumber, dictionary as getDictionary, stringValue as getStringValue, head, headName, isAtomic, isDictionaryObject, isFunctionObject, isStringObject, isSymbolObject, mapArgs, nops, op, symbol,
|
|
234
|
+
export { applyRecursively, asValidJSONNumber, dictionary as getDictionary, stringValue as getStringValue, head, headName, isAtomic, isDictionaryObject, isFunctionObject, isStringObject, isSymbolObject, mapArgs, nops, op, symbol, version };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** MathJSON 0.
|
|
2
|
-
function n(n){return null!==n&&"object"==typeof n&&"sym"in n}function t(n){return null!==n&&"object"==typeof n&&"str"in n}function r(n){return null!==n&&"object"==typeof n&&"fn"in n}function u(n){return null!==n&&"object"==typeof n&&"dict"in n}function l(n){return null===n||!Array.isArray(n)&&("object"!=typeof n||!("fn"in n||"dic"in n))}function e(n){return null
|
|
1
|
+
/** MathJSON 0.7.0 */
|
|
2
|
+
function n(n){return null!==n&&"object"==typeof n&&"sym"in n}function t(n){return null!==n&&"object"==typeof n&&"str"in n}function r(n){return null!==n&&"object"==typeof n&&"fn"in n}function u(n){return null!==n&&"object"==typeof n&&"dict"in n}function l(n){return null===n||!Array.isArray(n)&&("object"!=typeof n||!("fn"in n||"dic"in n))}function e(n){return null==n?null:"object"==typeof n&&"str"in n?n.str:"string"!=typeof n||n.length<2||"'"!==n[0]||"'"!==n[n.length-1]?null:n.substring(1,n.length-1)}function i(n){return null==n?null:Array.isArray(n)?n[0]:r(n)?n.fn[0]:null}function o(n){const t=i(n);return"string"==typeof t?t:""}function f(n,t){return null==n?null:Array.isArray(n)?n[t]??null:r(n)?n.fn[t]??null:null}function c(n){return null==n?null:Array.isArray(n)?n.slice(1):r(n)?n.fn.slice(1):null}function s(n){return null==n?0:Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function y(t){if(null==t)return null;const r=n(t)?t.sym:t;return"string"!=typeof r||r.length>=2&&"'"===r[0]&&"'"===r[r.length-1]?null:r}function a(n){const t=i(n);if("KeyValuePair"===t||"Tuple"===t||"Pair"===t){const t=e(f(n,1));return t?[t,f(n,2)??"Nothing"]:null}return null}function g(n){if(null===n)return null;if("object"==typeof n&&"dict"in n)return n.dict;const t=a(n);if(t)return{[t[0]]:t[1]};if("Dictionary"===i(n)){const t={};for(let r=1;r<s(n);r++){const u=a(f(n,r));u&&(t[u[0]]=u[1])}return t}return null}function p(n,t){const r=i(n);if(null!==r)return[t(r),...(c(n)??[]).map(t)];const u=g(n);if(null!==u){const n=Object.keys(u),r={};for(const l of n)r[l]=t(u[l]);return{dict:r}}return t(n)}function h(n,t){let u=null;if(Array.isArray(n)&&(u=n),r(n)&&(u=n.fn),null===u)return[];let l=1;const e=[];for(;l<u.length;)e.push(t(u[l])),l+=1;return e}function A(n){if("string"==typeof n){const t=Number(n);if("+"===n[0]&&(n=n.slice(1)),t.toString()===n)return isNaN(t)||!isFinite(t)?t.toString():t}return n}const b="0.7.0";export{p as applyRecursively,A as asValidJSONNumber,g as getDictionary,e as getStringValue,i as head,o as headName,l as isAtomic,u as isDictionaryObject,r as isFunctionObject,t as isStringObject,n as isSymbolObject,h as mapArgs,s as nops,f as op,y as symbol,b as version};
|
package/dist/math-json.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** MathJSON 0.
|
|
2
|
-
var global,factory;global=this,factory=function(n){function t(n){return null!==n&&"object"==typeof n&&"sym"in n}function r(n){return null!==n&&"object"==typeof n&&"fn"in n}function e(n){return null
|
|
1
|
+
/** MathJSON 0.7.0 */
|
|
2
|
+
var global,factory;global=this,factory=function(n){function t(n){return null!==n&&"object"==typeof n&&"sym"in n}function r(n){return null!==n&&"object"==typeof n&&"fn"in n}function l(n){return null==n?null:"object"==typeof n&&"str"in n?n.str:"string"!=typeof n||n.length<2||"'"!==n[0]||"'"!==n[n.length-1]?null:n.substring(1,n.length-1)}function e(n){return null==n?null:Array.isArray(n)?n[0]:r(n)?n.fn[0]:null}function i(n,t){var l,e;return null==n?null:Array.isArray(n)?null!==(l=n[t])&&void 0!==l?l:null:r(n)&&null!==(e=n.fn[t])&&void 0!==e?e:null}function u(n){return null==n?null:Array.isArray(n)?n.slice(1):r(n)?n.fn.slice(1):null}function o(n){return null==n?0:Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function f(n){var t;const r=e(n);if("KeyValuePair"===r||"Tuple"===r||"Pair"===r){const r=l(i(n,1));return r?[r,null!==(t=i(n,2))&&void 0!==t?t:"Nothing"]:null}return null}function c(n){if(null===n)return null;if("object"==typeof n&&"dict"in n)return n.dict;const t=f(n);if(t)return{[t[0]]:t[1]};if("Dictionary"===e(n)){const t={};for(let r=1;r<o(n);r++){const l=f(i(n,r));l&&(t[l[0]]=l[1])}return t}return null}n.applyRecursively=function(n,t){var r;const l=e(n);if(null!==l)return[t(l),...(null!==(r=u(n))&&void 0!==r?r:[]).map(t)];const i=c(n);if(null!==i){const n=Object.keys(i),r={};for(const l of n)r[l]=t(i[l]);return{dict:r}}return t(n)},n.asValidJSONNumber=function(n){if("string"==typeof n){const t=Number(n);if("+"===n[0]&&(n=n.slice(1)),t.toString()===n)return isNaN(t)||!isFinite(t)?t.toString():t}return n},n.getDictionary=c,n.getStringValue=l,n.head=e,n.headName=function(n){const t=e(n);return"string"==typeof t?t:""},n.isAtomic=function(n){return null===n||!Array.isArray(n)&&("object"!=typeof n||!("fn"in n||"dic"in n))},n.isDictionaryObject=function(n){return null!==n&&"object"==typeof n&&"dict"in n},n.isFunctionObject=r,n.isStringObject=function(n){return null!==n&&"object"==typeof n&&"str"in n},n.isSymbolObject=t,n.mapArgs=function(n,t){let l=null;if(Array.isArray(n)&&(l=n),r(n)&&(l=n.fn),null===l)return[];let e=1;const i=[];for(;e<l.length;)i.push(t(l[e])),e+=1;return i},n.nops=o,n.op=i,n.symbol=function(n){if(null==n)return null;const r=t(n)?n.sym:n;return"string"!=typeof r||r.length>=2&&"'"===r[0]&&"'"===r[r.length-1]?null:r},n.version="0.7.0",Object.defineProperty(n,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory((global="undefined"!=typeof globalThis?globalThis:global||self).MathJson={});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
export declare 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 declare type SignalMessage = SignalCode | [SignalCode, ...any[]];
|
|
4
4
|
export declare type SignalOrigin = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
/**
|
|
3
3
|
* Add an assumption, in the form of a predicate, for example:
|
|
4
4
|
*
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
* current context).
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
|
-
export declare function assume(
|
|
21
|
+
export declare function assume(proposition: BoxedExpression): AssumeResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
import type { Complex } from 'complex.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
|
-
import { BoxedExpression, BoxedFunctionDefinition, BoxedRuleSet, BoxedSymbolDefinition, EvaluateOptions, IComputeEngine, LatexString, Metadata, NOptions, PatternMatchOption, SemiBoxedExpression, SimplifyOptions, Substitution } from '../public';
|
|
4
|
+
import { BoxedExpression, BoxedFunctionDefinition, BoxedRuleSet, BoxedSymbolDefinition, BoxedDomain, EvaluateOptions, IComputeEngine, LatexString, Metadata, NOptions, PatternMatchOption, SemiBoxedExpression, SimplifyOptions, Substitution, RuntimeScope, DomainCompatibility, DomainLiteral, BoxedBaseDefinition } from '../public';
|
|
5
5
|
/**
|
|
6
6
|
* AbstractBoxedExpression
|
|
7
7
|
*/
|
|
@@ -15,8 +15,9 @@ export declare abstract class AbstractBoxedExpression implements BoxedExpression
|
|
|
15
15
|
abstract get hash(): number;
|
|
16
16
|
abstract match(rhs: BoxedExpression, options?: PatternMatchOption): Substitution | null;
|
|
17
17
|
readonly engine: IComputeEngine;
|
|
18
|
-
/**
|
|
19
|
-
* synthetically
|
|
18
|
+
/** Verbatim LaTeX, obtained from a source, i.e. from parsing, not generated
|
|
19
|
+
* synthetically
|
|
20
|
+
*/
|
|
20
21
|
protected _latex?: string;
|
|
21
22
|
protected _wikidata?: string;
|
|
22
23
|
constructor(ce: IComputeEngine, metadata?: Metadata);
|
|
@@ -28,25 +29,35 @@ export declare abstract class AbstractBoxedExpression implements BoxedExpression
|
|
|
28
29
|
valueOf(): number | string | [number, number];
|
|
29
30
|
/** Object.is() */
|
|
30
31
|
is(rhs: any): boolean;
|
|
32
|
+
isCompatible(_dom: BoxedDomain | DomainLiteral, _kind?: DomainCompatibility): boolean;
|
|
31
33
|
has(_v: string | string[]): boolean;
|
|
32
34
|
get description(): string[];
|
|
33
35
|
get url(): string;
|
|
34
|
-
_purge(): undefined;
|
|
35
36
|
get isPure(): boolean;
|
|
37
|
+
/** For a symbol, true if the symbol is a free variable (no value) */
|
|
38
|
+
get isFree(): boolean;
|
|
39
|
+
/** For a symbol, true if the symbol is a constant (unchangeable value) */
|
|
40
|
+
get isConstant(): boolean;
|
|
36
41
|
get isLiteral(): boolean;
|
|
37
42
|
get latex(): LatexString;
|
|
38
43
|
set latex(val: LatexString);
|
|
39
44
|
get wikidata(): string;
|
|
40
45
|
set wikidata(val: string);
|
|
41
46
|
get complexity(): number;
|
|
47
|
+
get symbols(): BoxedExpression[];
|
|
48
|
+
getSubexpressions(head: string): BoxedExpression[];
|
|
49
|
+
get subexpressions(): BoxedExpression[];
|
|
50
|
+
get errors(): BoxedExpression[];
|
|
42
51
|
get ops(): null | BoxedExpression[];
|
|
43
52
|
get nops(): number;
|
|
44
53
|
get op1(): BoxedExpression;
|
|
45
54
|
get op2(): BoxedExpression;
|
|
46
55
|
get op3(): BoxedExpression;
|
|
56
|
+
get basedDefinition(): BoxedBaseDefinition | undefined;
|
|
47
57
|
get symbolDefinition(): BoxedSymbolDefinition | undefined;
|
|
48
58
|
get functionDefinition(): BoxedFunctionDefinition | undefined;
|
|
49
|
-
|
|
59
|
+
bind(_scope: RuntimeScope | null): void;
|
|
60
|
+
unbind(): void;
|
|
50
61
|
get keys(): IterableIterator<string> | null;
|
|
51
62
|
get keysCount(): number;
|
|
52
63
|
getKey(_key: string): BoxedExpression | undefined;
|
|
@@ -60,13 +71,15 @@ export declare abstract class AbstractBoxedExpression implements BoxedExpression
|
|
|
60
71
|
get asRational(): [number, number] | [null, null];
|
|
61
72
|
get sgn(): -1 | 0 | 1 | undefined | null;
|
|
62
73
|
get symbol(): string | null;
|
|
63
|
-
get
|
|
74
|
+
get isNothing(): boolean;
|
|
75
|
+
get isValid(): boolean;
|
|
64
76
|
get value(): BoxedExpression | undefined;
|
|
65
77
|
set value(_value: BoxedExpression | number | undefined);
|
|
66
78
|
get numericValue(): BoxedExpression | undefined;
|
|
67
|
-
|
|
68
|
-
get domain():
|
|
69
|
-
set domain(_domain:
|
|
79
|
+
isSubdomainOf(_d: BoxedExpression | string): undefined | boolean;
|
|
80
|
+
get domain(): BoxedDomain;
|
|
81
|
+
set domain(_domain: BoxedDomain);
|
|
82
|
+
get explicitDomain(): BoxedDomain | null;
|
|
70
83
|
get string(): string | null;
|
|
71
84
|
isLess(_rhs: BoxedExpression): boolean | undefined;
|
|
72
85
|
isLessEqual(_rhs: BoxedExpression): boolean | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { IComputeEngine, SemiBoxedExpression, BoxedExpression, Metadata } from '../public';
|
|
4
|
-
import {
|
|
4
|
+
import { MathJsonNumber } from '../../math-json/math-json-format';
|
|
5
5
|
/**
|
|
6
6
|
* Notes about the boxed form:
|
|
7
7
|
*
|
|
@@ -36,21 +36,7 @@ export declare function box(ce: IComputeEngine, expr: Decimal | Complex | [num:
|
|
|
36
36
|
*
|
|
37
37
|
*
|
|
38
38
|
* Note that `boxNumber()` should only be called from `ComputeEngine`
|
|
39
|
-
*/
|
|
40
|
-
export declare function boxNumber(ce: IComputeEngine, num: MathJsonNumber | BoxedExpression | number | Complex | Decimal | [numer: number, denom: number], metadata?: Metadata): BoxedExpression | null;
|
|
41
|
-
/**
|
|
42
|
-
* Note that `boxDomain()` should only be called from `ComputeEngine`
|
|
43
|
-
*/
|
|
44
|
-
export declare function boxDomain(ce: IComputeEngine, dom: string | BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
45
|
-
/**
|
|
46
|
-
* Given a head (either as a string or a lambda expression)
|
|
47
|
-
* and a set of arguments, return a boxed function expression.
|
|
48
|
-
*
|
|
49
|
-
* If available, preserve LaTeX and wikidata metadata in the boxed expression.
|
|
50
39
|
*
|
|
51
|
-
* The result
|
|
52
|
-
*
|
|
53
|
-
* Note that `boxFunction()` should only be called from `ComputeEngine` or
|
|
54
|
-
* `box()`
|
|
40
|
+
* The result may not be canonical
|
|
55
41
|
*/
|
|
56
|
-
export declare function
|
|
42
|
+
export declare function boxNumber(ce: IComputeEngine, num: MathJsonNumber | BoxedExpression | number | Complex | Decimal | [numer: number, denom: number], metadata?: Metadata): BoxedExpression | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import { BoxedExpression, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, ReplaceOptions, Substitution, Metadata, PatternMatchOption } from '../public';
|
|
1
|
+
/* 0.7.0 */
|
|
2
|
+
import { BoxedExpression, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, ReplaceOptions, Substitution, Metadata, PatternMatchOption, BoxedDomain } from '../public';
|
|
3
3
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
4
4
|
/**
|
|
5
5
|
* BoxedDictionary
|
|
@@ -10,7 +10,7 @@ export declare class BoxedDictionary extends AbstractBoxedExpression {
|
|
|
10
10
|
constructor(ce: IComputeEngine, dict: {
|
|
11
11
|
[key: string]: SemiBoxedExpression;
|
|
12
12
|
}, metadata?: Metadata);
|
|
13
|
-
|
|
13
|
+
unbind(): undefined;
|
|
14
14
|
get hash(): number;
|
|
15
15
|
get complexity(): number;
|
|
16
16
|
get head(): 'Dictionary';
|
|
@@ -20,7 +20,7 @@ export declare class BoxedDictionary extends AbstractBoxedExpression {
|
|
|
20
20
|
get keys(): IterableIterator<string>;
|
|
21
21
|
get keysCount(): number;
|
|
22
22
|
has(x: string | string[]): boolean;
|
|
23
|
-
get domain():
|
|
23
|
+
get domain(): BoxedDomain;
|
|
24
24
|
get json(): Expression;
|
|
25
25
|
/** Structural equality */
|
|
26
26
|
isSame(rhs: BoxedExpression): boolean;
|
|
@@ -1,8 +1,51 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import { BoxedExpression, IComputeEngine, Metadata } from '../public';
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/* 0.7.0 */
|
|
2
|
+
import { BoxedDomain, BoxedExpression, DomainCompatibility, DomainConstructor, DomainExpression, DomainLiteral, IComputeEngine, Metadata, PatternMatchOption, Substitution } from '../public';
|
|
3
|
+
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
4
|
+
/**
|
|
5
|
+
* A `_BoxedDomain` is a wrapper around a boxed, canonical, domain expression.
|
|
6
|
+
*
|
|
7
|
+
* If could also be an error, in which case, `isValid` is `false`.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare class _BoxedDomain extends AbstractBoxedExpression implements BoxedDomain {
|
|
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>;
|
|
17
|
+
private _hash;
|
|
18
|
+
constructor(ce: IComputeEngine, dom: DomainExpression, metadata?: Metadata);
|
|
19
|
+
get isCanonical(): boolean;
|
|
20
|
+
/** Boxed domains are always canonical. */
|
|
21
|
+
get canonical(): _BoxedDomain;
|
|
22
|
+
get isValid(): boolean;
|
|
23
|
+
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
|
+
get hash(): number;
|
|
30
|
+
isEqual(rhs: BoxedExpression): boolean;
|
|
31
|
+
isSame(rhs: BoxedExpression): boolean;
|
|
32
|
+
is(rhs: any): boolean;
|
|
33
|
+
isCompatible(dom: BoxedDomain | DomainLiteral, compatibility?: DomainCompatibility): boolean;
|
|
34
|
+
match(rhs: BoxedExpression, _options?: PatternMatchOption): Substitution | null;
|
|
5
35
|
get head(): string;
|
|
6
|
-
get domain():
|
|
7
|
-
|
|
36
|
+
get domain(): BoxedDomain;
|
|
37
|
+
get isNothing(): boolean;
|
|
38
|
+
get isFunction(): boolean;
|
|
39
|
+
get isNumeric(): boolean;
|
|
40
|
+
get isRelationalOperator(): boolean;
|
|
8
41
|
}
|
|
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: BoxedDomain | DomainExpression, metadata?: Metadata): BoxedDomain;
|
|
47
|
+
/** Validate that `expr` is a Domain */
|
|
48
|
+
export declare function isDomain(expr: Expression | BoxedExpression | BoxedDomain | DomainExpression): expr is BoxedDomain | DomainExpression;
|
|
49
|
+
export declare function isSubdomainOf(lhs: DomainExpression<BoxedExpression>, rhs: DomainExpression<BoxedExpression>): boolean;
|
|
50
|
+
/** Return the ancestor domain that is shared by both `a` and `b` */
|
|
51
|
+
export declare function sharedAncestorDomain(a: BoxedDomain, b: BoxedDomain): BoxedDomain;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
export declare function makeFunctionDefinition(engine: IComputeEngine, def: FunctionDefinition): BoxedFunctionDefinition;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
import { Expression } from '../../math-json/math-json-format';
|
|
3
|
-
import { BoxedExpression, BoxedFunctionDefinition, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, Substitution, ReplaceOptions, Metadata, PatternMatchOption } from '../public';
|
|
3
|
+
import { BoxedExpression, BoxedFunctionDefinition, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, Substitution, ReplaceOptions, Metadata, PatternMatchOption, BoxedDomain, BoxedLambdaExpression, RuntimeScope } from '../public';
|
|
4
4
|
/**
|
|
5
5
|
* BoxedFunction
|
|
6
6
|
*/
|
|
7
7
|
export declare class BoxedFunction extends AbstractBoxedExpression {
|
|
8
|
+
private _scope;
|
|
8
9
|
private _head;
|
|
9
10
|
private _ops;
|
|
10
11
|
private _def;
|
|
11
12
|
private _isCanonical;
|
|
12
13
|
private _isPure;
|
|
14
|
+
/** The domain of the value of the function applied to its arguments */
|
|
15
|
+
private _codomain;
|
|
13
16
|
/** The cached values of applying the tail to the head.
|
|
14
17
|
* If the function is not pure, it is never cached.
|
|
15
18
|
*/
|
|
@@ -18,7 +21,7 @@ export declare class BoxedFunction extends AbstractBoxedExpression {
|
|
|
18
21
|
private _hash;
|
|
19
22
|
constructor(ce: IComputeEngine, head: string | BoxedExpression, ops: BoxedExpression[], metadata?: Metadata);
|
|
20
23
|
get hash(): number;
|
|
21
|
-
|
|
24
|
+
unbind(): void;
|
|
22
25
|
get wikidata(): string;
|
|
23
26
|
get description(): string[];
|
|
24
27
|
get url(): string;
|
|
@@ -28,15 +31,15 @@ export declare class BoxedFunction extends AbstractBoxedExpression {
|
|
|
28
31
|
get numericValue(): BoxedExpression | undefined;
|
|
29
32
|
get isPure(): boolean;
|
|
30
33
|
get isLiteral(): boolean;
|
|
34
|
+
get isValid(): boolean;
|
|
31
35
|
get ops(): BoxedExpression[];
|
|
32
36
|
get nops(): number;
|
|
33
37
|
get op1(): BoxedExpression;
|
|
34
38
|
get op2(): BoxedExpression;
|
|
35
39
|
get op3(): BoxedExpression;
|
|
36
40
|
get functionDefinition(): BoxedFunctionDefinition | undefined;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
get domain(): BoxedExpression;
|
|
41
|
+
bind(scope: RuntimeScope | null): void;
|
|
42
|
+
get domain(): BoxedDomain;
|
|
40
43
|
isLess(rhs: BoxedExpression): boolean | undefined;
|
|
41
44
|
isLessEqual(rhs: BoxedExpression): boolean | undefined;
|
|
42
45
|
isGreater(rhs: BoxedExpression): boolean | undefined;
|
|
@@ -68,8 +71,8 @@ export declare class BoxedFunction extends AbstractBoxedExpression {
|
|
|
68
71
|
map<T = BoxedExpression>(fn: (x: BoxedExpression) => T): IterableIterator<T>;
|
|
69
72
|
get isCanonical(): boolean;
|
|
70
73
|
set isCanonical(val: boolean);
|
|
71
|
-
get canonical(): BoxedExpression;
|
|
72
74
|
apply(fn: (x: BoxedExpression) => SemiBoxedExpression, head?: string): BoxedExpression;
|
|
75
|
+
get canonical(): BoxedExpression;
|
|
73
76
|
simplify(options?: SimplifyOptions): BoxedExpression;
|
|
74
77
|
evaluate(options?: EvaluateOptions): BoxedExpression;
|
|
75
78
|
N(options?: NOptions): BoxedExpression;
|
|
@@ -77,8 +80,7 @@ export declare class BoxedFunction extends AbstractBoxedExpression {
|
|
|
77
80
|
replace(rules: BoxedRuleSet, options?: ReplaceOptions): BoxedExpression | null;
|
|
78
81
|
subs(sub: Substitution): BoxedExpression;
|
|
79
82
|
}
|
|
80
|
-
export declare function lambda(fn:
|
|
81
|
-
export declare function ungroup(expr: BoxedExpression): BoxedExpression;
|
|
83
|
+
export declare function lambda(ce: IComputeEngine, fn: BoxedLambdaExpression, args: BoxedExpression[]): BoxedExpression;
|
|
82
84
|
/** Apply the function `f` to elements of `xs`, except to the elements
|
|
83
85
|
* described by `skip`:
|
|
84
86
|
* - `all`: don't apply f to any elements
|
|
@@ -88,8 +90,9 @@ export declare function ungroup(expr: BoxedExpression): BoxedExpression;
|
|
|
88
90
|
* - 'last': apply `f` to all elements except the last
|
|
89
91
|
* - 'most': apply `f` to the last elements, skip the others
|
|
90
92
|
*
|
|
91
|
-
* Account for `Hold`, `ReleaseHold` and
|
|
93
|
+
* Account for `Hold`, `ReleaseHold`, `Sequence`, `Symbol` and `Nothing`.
|
|
92
94
|
*
|
|
93
95
|
* If `f` returns `null`, the element is not added to the result
|
|
94
96
|
*/
|
|
95
|
-
export declare function holdMap(xs: BoxedExpression[], skip: 'all' | 'none' | 'first' | 'rest' | 'last' | 'most', f: (
|
|
97
|
+
export declare function holdMap(head: string, xs: BoxedExpression[], skip: 'all' | 'none' | 'first' | 'rest' | 'last' | 'most', associative: boolean, f: (x: BoxedExpression) => BoxedExpression | null): BoxedExpression[];
|
|
98
|
+
export declare function canonicalHoldMap(head: string, xs: BoxedExpression[], skip: 'all' | 'none' | 'first' | 'rest' | 'last' | 'most', associative: boolean): BoxedExpression[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
import { Complex } from 'complex.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
|
-
import { BoxedExpression, IComputeEngine, Metadata, NOptions, PatternMatchOption, SimplifyOptions, Substitution } from '../public';
|
|
4
|
+
import { BoxedExpression, BoxedDomain, IComputeEngine, Metadata, NOptions, PatternMatchOption, SimplifyOptions, Substitution } from '../public';
|
|
5
5
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
6
6
|
/**
|
|
7
7
|
* BoxedNumber
|
|
@@ -34,7 +34,7 @@ export declare class BoxedNumber extends AbstractBoxedExpression {
|
|
|
34
34
|
get asFloat(): number | null;
|
|
35
35
|
get asSmallInteger(): number | null;
|
|
36
36
|
get asRational(): [number, number] | [null, null];
|
|
37
|
-
get domain():
|
|
37
|
+
get domain(): BoxedDomain;
|
|
38
38
|
get json(): Expression;
|
|
39
39
|
get sgn(): -1 | 0 | 1 | undefined | null;
|
|
40
40
|
isSame(rhs: BoxedExpression): boolean;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
3
|
-
import { BoxedExpression, IComputeEngine, LatexString, Metadata, Pattern, PatternMatchOption, SemiBoxedExpression, Substitution } from '../public';
|
|
3
|
+
import { BoxedExpression, BoxedSubstitution, BoxedDomain, IComputeEngine, LatexString, Metadata, Pattern, PatternMatchOption, SemiBoxedExpression, Substitution } from '../public';
|
|
4
4
|
export declare class BoxedPattern extends AbstractBoxedExpression implements Pattern {
|
|
5
5
|
_pattern: BoxedExpression;
|
|
6
6
|
_canonicalPattern: BoxedExpression | undefined;
|
|
7
7
|
constructor(ce: IComputeEngine, pattern: LatexString | SemiBoxedExpression, metadata?: Metadata);
|
|
8
8
|
get hash(): number;
|
|
9
|
-
|
|
9
|
+
unbind(): void;
|
|
10
10
|
get json(): Expression;
|
|
11
11
|
get head(): string | BoxedExpression;
|
|
12
|
-
get domain():
|
|
12
|
+
get domain(): BoxedDomain;
|
|
13
13
|
get isCanonical(): boolean;
|
|
14
14
|
set isCanonical(_val: boolean);
|
|
15
15
|
isSame(rhs: BoxedExpression): boolean;
|
|
16
16
|
isEqual(rhs: BoxedExpression): boolean;
|
|
17
|
-
match(expr: BoxedExpression, options?: PatternMatchOption):
|
|
17
|
+
match(expr: BoxedExpression, options?: PatternMatchOption): BoxedSubstitution | null;
|
|
18
18
|
test(expr: BoxedExpression, options?: PatternMatchOption): boolean;
|
|
19
19
|
count(exprs: Iterable<BoxedExpression>, options?: PatternMatchOption): number;
|
|
20
20
|
subs(sub: Substitution): BoxedPattern;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
3
|
-
import { BoxedExpression, IComputeEngine, Metadata, PatternMatchOption, Substitution } from '../public';
|
|
3
|
+
import { BoxedExpression, BoxedDomain, IComputeEngine, Metadata, PatternMatchOption, Substitution } from '../public';
|
|
4
4
|
/**
|
|
5
5
|
* BoxedString
|
|
6
6
|
*/
|
|
@@ -14,7 +14,7 @@ export declare class BoxedString extends AbstractBoxedExpression {
|
|
|
14
14
|
get isLiteral(): boolean;
|
|
15
15
|
get isCanonical(): boolean;
|
|
16
16
|
set isCanonical(_va: boolean);
|
|
17
|
-
get domain():
|
|
17
|
+
get domain(): BoxedDomain;
|
|
18
18
|
get complexity(): number;
|
|
19
19
|
get string(): string;
|
|
20
20
|
isEqual(rhs: BoxedExpression): boolean;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
export declare function domainToFlags(dom:
|
|
1
|
+
/* 0.7.0 */
|
|
2
|
+
export declare function domainToFlags(dom: BoxedDomain | undefined | null): Partial<SymbolFlags>;
|
|
3
3
|
export declare class BoxedSymbolDefinitionImpl implements BoxedSymbolDefinition {
|
|
4
4
|
private _engine;
|
|
5
|
+
readonly scope: RuntimeScope | undefined;
|
|
5
6
|
private _value;
|
|
6
7
|
readonly name: string;
|
|
7
8
|
wikidata?: string;
|
|
8
9
|
description?: string | string[];
|
|
9
|
-
readonly scope: RuntimeScope | undefined;
|
|
10
10
|
private _domain;
|
|
11
|
+
private _inferedDomain;
|
|
11
12
|
private _number;
|
|
12
13
|
private _integer;
|
|
13
14
|
private _rational;
|
|
@@ -38,13 +39,15 @@ export declare class BoxedSymbolDefinitionImpl implements BoxedSymbolDefinition
|
|
|
38
39
|
readonly hold: boolean;
|
|
39
40
|
private _def;
|
|
40
41
|
prototype?: BoxedFunctionDefinition;
|
|
41
|
-
self?:
|
|
42
|
+
self?: unknown;
|
|
42
43
|
constructor(ce: IComputeEngine, def: SymbolDefinition);
|
|
43
|
-
|
|
44
|
+
reset(): void;
|
|
45
|
+
unbind(): void;
|
|
46
|
+
bind(): void;
|
|
44
47
|
get value(): BoxedExpression | undefined;
|
|
45
48
|
set value(val: BoxedExpression | number | undefined);
|
|
46
|
-
get domain():
|
|
47
|
-
set domain(domain:
|
|
49
|
+
get domain(): BoxedDomain | undefined;
|
|
50
|
+
set domain(domain: BoxedDomain | DomainExpression | undefined);
|
|
48
51
|
updateFlags(flags: Partial<SymbolFlags>): void;
|
|
49
52
|
setProps(props: Omit<Partial<BoxedSymbolDefinition>, 'domain' | 'value'>): void;
|
|
50
53
|
get number(): boolean | undefined;
|