@cortex-js/compute-engine 0.6.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.
Files changed (91) hide show
  1. package/dist/compute-engine.esm.js +15779 -12531
  2. package/dist/compute-engine.min.esm.js +2 -2
  3. package/dist/compute-engine.min.js +2 -2
  4. package/dist/math-json.esm.js +62 -43
  5. package/dist/math-json.min.esm.js +2 -2
  6. package/dist/math-json.min.js +2 -2
  7. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  8. package/dist/types/common/signals.d.ts +1 -1
  9. package/dist/types/compute-engine/assume.d.ts +2 -2
  10. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +22 -10
  11. package/dist/types/compute-engine/boxed-expression/box.d.ts +2 -14
  12. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +4 -4
  13. package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +36 -19
  14. package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +1 -1
  15. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +14 -13
  16. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +3 -3
  17. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +5 -5
  18. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +3 -3
  19. package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +9 -6
  20. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +24 -10
  21. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  22. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  23. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
  24. package/dist/types/compute-engine/boxed-expression/utils.d.ts +23 -6
  25. package/dist/types/compute-engine/compute-engine.d.ts +74 -50
  26. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  27. package/dist/types/compute-engine/domain-utils.d.ts +1 -1
  28. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  29. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  30. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  31. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -3
  32. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-inequalities.d.ts +1 -1
  33. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  34. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  35. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  36. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  37. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  38. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +8 -7
  39. package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +3 -3
  40. package/dist/types/compute-engine/latex-syntax/parse.d.ts +87 -62
  41. package/dist/types/compute-engine/latex-syntax/public.d.ts +65 -46
  42. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
  43. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
  44. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +6 -4
  45. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  46. package/dist/types/compute-engine/library/arithmetic-add.d.ts +11 -0
  47. package/dist/types/compute-engine/library/arithmetic-divide.d.ts +15 -0
  48. package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +19 -0
  49. package/dist/types/compute-engine/{dictionary → library}/arithmetic-power.d.ts +1 -1
  50. package/dist/types/compute-engine/library/arithmetic.d.ts +2 -0
  51. package/dist/types/compute-engine/library/calculus.d.ts +2 -0
  52. package/dist/types/compute-engine/library/collections.d.ts +2 -0
  53. package/dist/types/compute-engine/library/core.d.ts +2 -0
  54. package/dist/types/compute-engine/library/domains.d.ts +15 -0
  55. package/dist/types/compute-engine/library/library.d.ts +17 -0
  56. package/dist/types/compute-engine/library/logic.d.ts +2 -0
  57. package/dist/types/compute-engine/library/polynomials.d.ts +2 -0
  58. package/dist/types/compute-engine/library/relational-operator.d.ts +2 -0
  59. package/dist/types/compute-engine/library/sets.d.ts +2 -0
  60. package/dist/types/compute-engine/library/trigonometry.d.ts +2 -0
  61. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  62. package/dist/types/compute-engine/numerics/numeric-decimal.d.ts +5 -1
  63. package/dist/types/compute-engine/numerics/numeric.d.ts +4 -2
  64. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  65. package/dist/types/compute-engine/public.d.ts +237 -187
  66. package/dist/types/compute-engine/rules.d.ts +1 -1
  67. package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
  68. package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
  69. package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -1
  70. package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
  71. package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
  72. package/dist/types/compute-engine/symbolic/product.d.ts +1 -1
  73. package/dist/types/compute-engine/symbolic/sum.d.ts +2 -2
  74. package/dist/types/compute-engine/symbolic/utils.d.ts +1 -1
  75. package/dist/types/compute-engine.d.ts +2 -2
  76. package/dist/types/math-json/math-json-format.d.ts +27 -23
  77. package/dist/types/math-json/utils.d.ts +22 -16
  78. package/dist/types/math-json.d.ts +3 -3
  79. package/package.json +20 -20
  80. package/dist/types/compute-engine/dictionary/arithmetic-add.d.ts +0 -11
  81. package/dist/types/compute-engine/dictionary/arithmetic-divide.d.ts +0 -9
  82. package/dist/types/compute-engine/dictionary/arithmetic-multiply.d.ts +0 -17
  83. package/dist/types/compute-engine/dictionary/arithmetic.d.ts +0 -2
  84. package/dist/types/compute-engine/dictionary/collections.d.ts +0 -2
  85. package/dist/types/compute-engine/dictionary/core.d.ts +0 -2
  86. package/dist/types/compute-engine/dictionary/dictionary.d.ts +0 -26
  87. package/dist/types/compute-engine/dictionary/logic.d.ts +0 -2
  88. package/dist/types/compute-engine/dictionary/polynomials.d.ts +0 -2
  89. package/dist/types/compute-engine/dictionary/relational-operator.d.ts +0 -2
  90. package/dist/types/compute-engine/dictionary/sets.d.ts +0 -2
  91. package/dist/types/compute-engine/dictionary/trigonometry.d.ts +0 -2
@@ -1,4 +1,4 @@
1
- /** MathJSON 0.6.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,43 +76,43 @@ 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 (Array.isArray(expr)) {
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)
90
103
  return null;
91
104
  const s = isSymbolObject(expr) ? expr.sym : expr;
92
105
  if (typeof s !== 'string')
93
106
  return null;
94
- if (s.length >= 2 && s[0] === "'" && s[s.length - 1] === "'") {
95
- // It's a string literal, not a symbol
107
+ // Is it a string literal?
108
+ if (s.length >= 2 && s[0] === "'" && s[s.length - 1] === "'")
96
109
  return null;
97
- }
98
110
  return s;
99
111
  }
100
- function string(expr) {
101
- if (expr === null)
102
- return null;
103
- const s = isSymbolObject(expr) ? expr.sym : expr;
104
- if (typeof s !== 'string')
105
- return null;
106
- if (s.length < 2 || s[0] !== "'" || s[s.length - 1] !== "'") {
107
- // It's a symbol
108
- return null;
109
- }
110
- return s.slice(1, -1);
111
- }
112
112
  function keyValuePair(expr) {
113
113
  const h = head(expr);
114
114
  if (h === 'KeyValuePair' || h === 'Tuple' || h === 'Pair') {
115
- const key = string(op(expr, 1));
115
+ const key = stringValue(op(expr, 1));
116
116
  if (!key)
117
117
  return null;
118
118
  return [key, op(expr, 2) ?? 'Nothing'];
@@ -128,7 +128,7 @@ function dictionary(expr) {
128
128
  if (kv)
129
129
  return { [kv[0]]: kv[1] };
130
130
  const h = head(expr);
131
- if (h === 'List' || h === 'Dictionary') {
131
+ if (h === 'Dictionary') {
132
132
  const result = {};
133
133
  for (let i = 1; i < nops(expr); i++) {
134
134
  const kv = keyValuePair(op(expr, i));
@@ -139,23 +139,10 @@ function dictionary(expr) {
139
139
  }
140
140
  return null;
141
141
  }
142
- /**
143
- * Return all the elements but the first one, i.e. the arguments of a
144
- * function.
145
- */
146
- function tail(expr) {
147
- if (Array.isArray(expr)) {
148
- return expr.slice(1);
149
- }
150
- if (isFunctionObject(expr)) {
151
- return expr.fn.slice(1);
152
- }
153
- return [];
154
- }
155
142
  function applyRecursively(expr, fn) {
156
143
  const h = head(expr);
157
144
  if (h !== null) {
158
- return [fn(h), ...tail(expr).map(fn)];
145
+ return [fn(h), ...(ops(expr) ?? []).map(fn)];
159
146
  }
160
147
  const dict = dictionary(expr);
161
148
  if (dict !== null) {
@@ -207,9 +194,41 @@ function asValidJSONNumber(num) {
207
194
  }
208
195
  }
209
196
  return num;
210
- }
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
+ // }
211
230
 
212
231
  // This is the root of the `math-json` package (i.e. `math-json.js` and
213
- const version = '0.6.0';
232
+ const version = '0.7.0';
214
233
 
215
- export { applyRecursively, asValidJSONNumber, dictionary as getDictionary, stringValue as getStringValue, head, headName, isAtomic, isDictionaryObject, isFunctionObject, isStringObject, isSymbolObject, mapArgs, nops, op, symbol, tail, version };
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.6.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 c(n,t){return null===n?null:Array.isArray(n)?n[t]??null:r(n)?n.fn[t]??null:null}function f(n){return Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function s(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 y(t){const r=i(t);if("KeyValuePair"===r||"Tuple"===r||"Pair"===r){const r=function(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.slice(1,-1)}(c(t,1));return r?[r,c(t,2)??"Nothing"]:null}return null}function a(n){if(null===n)return null;if("object"==typeof n&&"dict"in n)return n.dict;const t=y(n);if(t)return{[t[0]]:t[1]};const r=i(n);if("List"===r||"Dictionary"===r){const t={};for(let r=1;r<f(n);r++){const u=y(c(n,r));u&&(t[u[0]]=u[1])}return t}return null}function g(n){return Array.isArray(n)?n.slice(1):r(n)?n.fn.slice(1):[]}function p(n,t){const r=i(n);if(null!==r)return[t(r),...g(n).map(t)];const u=a(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.6.0";export{p as applyRecursively,A as asValidJSONNumber,a 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,f as nops,c as op,s as symbol,g as tail,b as version};
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};
@@ -1,2 +1,2 @@
1
- /** MathJSON 0.6.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===n?null:Array.isArray(n)?n[0]:r(n)?n.fn[0]:null}function l(n,t){var e,l;return null===n?null:Array.isArray(n)?null!==(e=n[t])&&void 0!==e?e:null:r(n)&&null!==(l=n.fn[t])&&void 0!==l?l:null}function i(n){return Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function o(n){var r;const i=e(n);if("KeyValuePair"===i||"Tuple"===i||"Pair"===i){const e=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.slice(1,-1)}(l(n,1));return e?[e,null!==(r=l(n,2))&&void 0!==r?r:"Nothing"]:null}return null}function u(n){if(null===n)return null;if("object"==typeof n&&"dict"in n)return n.dict;const t=o(n);if(t)return{[t[0]]:t[1]};const r=e(n);if("List"===r||"Dictionary"===r){const t={};for(let r=1;r<i(n);r++){const e=o(l(n,r));e&&(t[e[0]]=e[1])}return t}return null}function f(n){return Array.isArray(n)?n.slice(1):r(n)?n.fn.slice(1):[]}n.applyRecursively=function(n,t){const r=e(n);if(null!==r)return[t(r),...f(n).map(t)];const l=u(n);if(null!==l){const n=Object.keys(l),r={};for(const e of n)r[e]=t(l[e]);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=u,n.getStringValue=function(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)},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 e=null;if(Array.isArray(n)&&(e=n),r(n)&&(e=n.fn),null===e)return[];let l=1;const i=[];for(;l<e.length;)i.push(t(e[l])),l+=1;return i},n.nops=i,n.op=l,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.tail=f,n.version="0.6.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
+ /** 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.6.0 */
1
+ /* 0.7.0 */
2
2
  /**
3
3
  * Return a string or an array of graphemes.
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.6.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.6.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(_proposition: BoxedExpression): AssumeResult;
21
+ export declare function assume(proposition: BoxedExpression): AssumeResult;
@@ -1,7 +1,7 @@
1
- /* 0.6.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, Domain, 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
- /** Authentic LaTeX, obtained from a source, i.e. from parsing, not generated
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
- _repairDefinition(): void;
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,14 +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 isMissing(): boolean;
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
79
  isSubdomainOf(_d: BoxedExpression | string): undefined | boolean;
68
- get domain(): Domain;
69
- set domain(_domain: Domain);
70
- get valueDomain(): Domain;
80
+ get domain(): BoxedDomain;
81
+ set domain(_domain: BoxedDomain);
82
+ get explicitDomain(): BoxedDomain | null;
71
83
  get string(): string | null;
72
84
  isLess(_rhs: BoxedExpression): boolean | undefined;
73
85
  isLessEqual(_rhs: BoxedExpression): boolean | undefined;
@@ -1,7 +1,7 @@
1
- /* 0.6.0 */
1
+ /* 0.7.0 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import { IComputeEngine, SemiBoxedExpression, BoxedExpression, Metadata } from '../public';
4
- import { Expression, MathJsonNumber } from '../../math-json/math-json-format';
4
+ import { MathJsonNumber } from '../../math-json/math-json-format';
5
5
  /**
6
6
  * Notes about the boxed form:
7
7
  *
@@ -40,15 +40,3 @@ export declare function box(ce: IComputeEngine, expr: Decimal | Complex | [num:
40
40
  * The result may not be canonical
41
41
  */
42
42
  export declare function boxNumber(ce: IComputeEngine, num: MathJsonNumber | BoxedExpression | number | Complex | Decimal | [numer: number, denom: number], metadata?: Metadata): BoxedExpression | null;
43
- /**
44
- * Given a head (either as a string or a lambda expression)
45
- * and a set of arguments, return a boxed function expression.
46
- *
47
- * If available, preserve LaTeX and wikidata metadata in the boxed expression.
48
- *
49
- * The result is *not* a canonical expression.
50
- *
51
- * Note that `boxFunction()` should only be called from `ComputeEngine` or
52
- * `box()`
53
- */
54
- export declare function boxFunction(ce: IComputeEngine, head: string, ops: Expression[], metadata?: Metadata): BoxedExpression;
@@ -1,5 +1,5 @@
1
- /* 0.6.0 */
2
- import { BoxedExpression, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, ReplaceOptions, Substitution, Metadata, PatternMatchOption, Domain } 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
- _purge(): undefined;
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(): Domain;
23
+ get domain(): BoxedDomain;
24
24
  get json(): Expression;
25
25
  /** Structural equality */
26
26
  isSame(rhs: BoxedExpression): boolean;
@@ -1,34 +1,51 @@
1
- /* 0.6.0 */
2
- import { BoxedExpression, Domain, DomainExpression, IComputeEngine, Metadata, PatternMatchOption, Substitution } from '../public';
1
+ /* 0.7.0 */
2
+ import { BoxedDomain, BoxedExpression, DomainCompatibility, DomainConstructor, DomainExpression, DomainLiteral, IComputeEngine, Metadata, PatternMatchOption, Substitution } from '../public';
3
3
  import { AbstractBoxedExpression } from './abstract-boxed-expression';
4
- export declare class _Domain extends AbstractBoxedExpression implements Domain {
5
- _value: DomainExpression;
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>;
6
17
  private _hash;
7
18
  constructor(ce: IComputeEngine, dom: DomainExpression, metadata?: Metadata);
8
- get domainExpression(): DomainExpression;
9
- get hash(): number;
10
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;
11
30
  isEqual(rhs: BoxedExpression): boolean;
12
31
  isSame(rhs: BoxedExpression): boolean;
13
- isSubdomainOf(rhs: _Domain | string): boolean;
14
- isMemberOf(expr: BoxedExpression): boolean;
15
- get json(): Expression;
32
+ is(rhs: any): boolean;
33
+ isCompatible(dom: BoxedDomain | DomainLiteral, compatibility?: DomainCompatibility): boolean;
16
34
  match(rhs: BoxedExpression, _options?: PatternMatchOption): Substitution | null;
17
35
  get head(): string;
18
- get domain(): Domain;
19
- get codomain(): Domain | null;
20
- is(rhs: BoxedExpression): boolean;
36
+ get domain(): BoxedDomain;
21
37
  get isNothing(): boolean;
22
38
  get isFunction(): boolean;
23
- get isPredicate(): boolean;
24
- get isNumericFunction(): boolean;
25
- get isBoolean(): boolean;
26
- get isRealFunction(): boolean;
27
39
  get isNumeric(): boolean;
28
- get isLogicOperator(): boolean;
29
40
  get isRelationalOperator(): boolean;
30
41
  }
31
42
  /**
32
- * Note that `boxDomain()` should only be called from `ComputeEngine`
43
+ * Note that `boxDomain()` should only be called from `ComputeEngine`.
44
+ * This gives a chance for `ComputeEngine` to substitute cached objects.
33
45
  */
34
- export declare function boxDomain(ce: IComputeEngine, dom: Domain | DomainExpression, metadata?: Metadata): Domain;
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.6.0 */
1
+ /* 0.7.0 */
2
2
  export declare function makeFunctionDefinition(engine: IComputeEngine, def: FunctionDefinition): BoxedFunctionDefinition;
@@ -1,15 +1,18 @@
1
- /* 0.6.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, Domain } 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
- _purge(): undefined;
24
+ unbind(): void;
22
25
  get wikidata(): string;
23
26
  get description(): string[];
24
27
  get url(): string;
@@ -28,17 +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
- _repairDefinition(): void;
38
- /** Signature of the function */
39
- get domain(): Domain;
40
- /** Domain of the value of the function */
41
- get valueDomain(): Domain;
41
+ bind(scope: RuntimeScope | null): void;
42
+ get domain(): BoxedDomain;
42
43
  isLess(rhs: BoxedExpression): boolean | undefined;
43
44
  isLessEqual(rhs: BoxedExpression): boolean | undefined;
44
45
  isGreater(rhs: BoxedExpression): boolean | undefined;
@@ -70,8 +71,8 @@ export declare class BoxedFunction extends AbstractBoxedExpression {
70
71
  map<T = BoxedExpression>(fn: (x: BoxedExpression) => T): IterableIterator<T>;
71
72
  get isCanonical(): boolean;
72
73
  set isCanonical(val: boolean);
73
- get canonical(): BoxedExpression;
74
74
  apply(fn: (x: BoxedExpression) => SemiBoxedExpression, head?: string): BoxedExpression;
75
+ get canonical(): BoxedExpression;
75
76
  simplify(options?: SimplifyOptions): BoxedExpression;
76
77
  evaluate(options?: EvaluateOptions): BoxedExpression;
77
78
  N(options?: NOptions): BoxedExpression;
@@ -79,8 +80,7 @@ export declare class BoxedFunction extends AbstractBoxedExpression {
79
80
  replace(rules: BoxedRuleSet, options?: ReplaceOptions): BoxedExpression | null;
80
81
  subs(sub: Substitution): BoxedExpression;
81
82
  }
82
- export declare function lambda(fn: BoxedExpression, args: BoxedExpression[]): BoxedExpression;
83
- export declare function ungroup(expr: BoxedExpression): BoxedExpression;
83
+ export declare function lambda(ce: IComputeEngine, fn: BoxedLambdaExpression, args: BoxedExpression[]): BoxedExpression;
84
84
  /** Apply the function `f` to elements of `xs`, except to the elements
85
85
  * described by `skip`:
86
86
  * - `all`: don't apply f to any elements
@@ -90,8 +90,9 @@ export declare function ungroup(expr: BoxedExpression): BoxedExpression;
90
90
  * - 'last': apply `f` to all elements except the last
91
91
  * - 'most': apply `f` to the last elements, skip the others
92
92
  *
93
- * Account for `Hold`, `ReleaseHold` and `Nothing`.
93
+ * Account for `Hold`, `ReleaseHold`, `Sequence`, `Symbol` and `Nothing`.
94
94
  *
95
95
  * If `f` returns `null`, the element is not added to the result
96
96
  */
97
- export declare function holdMap(xs: BoxedExpression[], skip: 'all' | 'none' | 'first' | 'rest' | 'last' | 'most', f: (BoxedExpression: any) => BoxedExpression | null): BoxedExpression[];
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.6.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, Domain, 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(): 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.6.0 */
1
+ /* 0.7.0 */
2
2
  import { AbstractBoxedExpression } from './abstract-boxed-expression';
3
- import { BoxedExpression, Domain, 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
- _purge(): undefined;
9
+ unbind(): void;
10
10
  get json(): Expression;
11
11
  get head(): string | BoxedExpression;
12
- get valueDomain(): 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): Substitution | null;
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.6.0 */
1
+ /* 0.7.0 */
2
2
  import { AbstractBoxedExpression } from './abstract-boxed-expression';
3
- import { BoxedExpression, Domain, 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(): 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.6.0 */
2
- export declare function domainToFlags(dom: Domain | undefined | null): Partial<SymbolFlags>;
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;
@@ -40,11 +41,13 @@ export declare class BoxedSymbolDefinitionImpl implements BoxedSymbolDefinition
40
41
  prototype?: BoxedFunctionDefinition;
41
42
  self?: unknown;
42
43
  constructor(ce: IComputeEngine, def: SymbolDefinition);
43
- _purge(): undefined;
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(): Domain | undefined;
47
- set domain(domain: Domain | undefined | string);
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;