@cortex-js/compute-engine 0.18.1 → 0.19.1

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 (101) hide show
  1. package/dist/compute-engine.esm.js +2947 -2472
  2. package/dist/compute-engine.js +2947 -2472
  3. package/dist/compute-engine.min.esm.js +16 -16
  4. package/dist/compute-engine.min.js +16 -16
  5. package/dist/math-json.esm.js +2 -2
  6. package/dist/math-json.js +2 -2
  7. package/dist/math-json.min.esm.js +2 -2
  8. package/dist/math-json.min.js +2 -2
  9. package/dist/types/common/ansi-codes.d.ts +1 -1
  10. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  11. package/dist/types/common/signals.d.ts +1 -1
  12. package/dist/types/common/utils.d.ts +1 -1
  13. package/dist/types/compute-engine/assume.d.ts +1 -1
  14. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +7 -5
  15. package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
  16. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
  17. package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +3 -6
  18. package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +1 -1
  19. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +3 -17
  20. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -2
  21. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
  22. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
  23. package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +1 -1
  24. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +9 -3
  25. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  26. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  27. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +2 -2
  28. package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
  29. package/dist/types/compute-engine/boxed-expression/validate.d.ts +4 -2
  30. package/dist/types/compute-engine/collection-utils.d.ts +46 -0
  31. package/dist/types/compute-engine/compile.d.ts +2 -2
  32. package/dist/types/compute-engine/compute-engine.d.ts +6 -1
  33. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  34. package/dist/types/compute-engine/domain-utils.d.ts +13 -2
  35. package/dist/types/compute-engine/function-utils.d.ts +1 -22
  36. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  37. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  38. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  39. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  40. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  41. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-inequalities.d.ts +1 -1
  42. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  43. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  44. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  45. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  46. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  47. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  48. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +5 -5
  49. package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
  50. package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +2 -2
  51. package/dist/types/compute-engine/latex-syntax/parse.d.ts +22 -46
  52. package/dist/types/compute-engine/latex-syntax/public.d.ts +8 -8
  53. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
  54. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +2 -2
  55. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +2 -2
  56. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  57. package/dist/types/compute-engine/library/arithmetic-add.d.ts +2 -2
  58. package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
  59. package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +2 -2
  60. package/dist/types/compute-engine/library/arithmetic-power.d.ts +1 -1
  61. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
  62. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  63. package/dist/types/compute-engine/library/collections.d.ts +2 -1
  64. package/dist/types/compute-engine/library/complex.d.ts +1 -1
  65. package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
  66. package/dist/types/compute-engine/library/core.d.ts +1 -1
  67. package/dist/types/compute-engine/library/domains.d.ts +1 -1
  68. package/dist/types/compute-engine/library/library.d.ts +1 -1
  69. package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
  70. package/dist/types/compute-engine/library/logic.d.ts +1 -1
  71. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  72. package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
  73. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
  74. package/dist/types/compute-engine/library/sets.d.ts +1 -1
  75. package/dist/types/compute-engine/library/statistics.d.ts +1 -1
  76. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  77. package/dist/types/compute-engine/library/utils.d.ts +29 -2
  78. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
  79. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
  80. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  81. package/dist/types/compute-engine/numerics/numeric.d.ts +6 -5
  82. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  83. package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
  84. package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
  85. package/dist/types/compute-engine/public.d.ts +37 -30
  86. package/dist/types/compute-engine/rules.d.ts +1 -1
  87. package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
  88. package/dist/types/compute-engine/solve.d.ts +1 -1
  89. package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
  90. package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
  91. package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -1
  92. package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
  93. package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
  94. package/dist/types/compute-engine/symbolic/product.d.ts +1 -1
  95. package/dist/types/compute-engine/symbolic/sum.d.ts +1 -1
  96. package/dist/types/compute-engine/symbolic/utils.d.ts +1 -1
  97. package/dist/types/compute-engine.d.ts +2 -2
  98. package/dist/types/math-json/math-json-format.d.ts +1 -1
  99. package/dist/types/math-json/utils.d.ts +1 -1
  100. package/dist/types/math-json.d.ts +2 -2
  101. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- /** CortexJS Compute Engine 0.18.1 */
1
+ /** CortexJS Compute Engine 0.19.1 */
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.18.1";
242
+ var version = "0.19.1";
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.18.1 */
1
+ /** CortexJS MathJSON 0.19.1 */
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.18.1";
280
+ var version = "0.19.1";
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.18.1 */
1
+ /** CortexJS Compute Engine 0.19.1 */
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.18.1";
242
+ var version = "0.19.1";
243
243
  export {
244
244
  applyRecursively,
245
245
  dictionary as getDictionary,
@@ -1,4 +1,4 @@
1
- /** CortexJS MathJSON 0.18.1 */
1
+ /** CortexJS MathJSON 0.19.1 */
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=(()=>{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.18.1";return _(z);})();
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.19.1";return _(z);})();
4
4
  Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const BLACK = "\u001B[30;1m${s}";
3
3
  export declare const GREY = "\u001B[30;1m${s}";
4
4
  export declare const GREEN = "\u001B[32;1m";
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  /**
3
3
  * Return a string or an array of graphemes.
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
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.18.1 */
1
+ /* 0.19.1 */
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  /**
3
3
  * Add an assumption, in the form of a predicate, for example:
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import type { Decimal } from 'decimal.js';
3
3
  import { Expression } from '../../math-json/math-json-format';
4
4
  import { BoxedExpression, BoxedFunctionDefinition, BoxedRuleSet, BoxedSymbolDefinition, BoxedDomain, EvaluateOptions, IComputeEngine, LatexString, Metadata, NOptions, PatternMatchOptions, SimplifyOptions, Substitution, RuntimeScope, DomainCompatibility, DomainLiteral, BoxedBaseDefinition, Rational, BoxedSubstitution } from '../public';
@@ -20,10 +20,12 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
20
20
  */
21
21
  protected _latex?: string;
22
22
  constructor(ce: IComputeEngine, metadata?: Metadata);
23
- /** `Object.valueOf()`: return a primitive value for the object
23
+ /**
24
+ *
25
+ * `Object.valueOf()`: return a JavaScript primitive value for the expression
24
26
  *
25
27
  */
26
- valueOf(): number | string | boolean;
28
+ valueOf(): number | any[] | string | boolean;
27
29
  /** Object.toString() */
28
30
  toString(): string;
29
31
  [Symbol.toPrimitive](hint: 'number' | 'string' | 'default'): number | string | null;
@@ -98,8 +100,8 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
98
100
  get keysCount(): number;
99
101
  getKey(_key: string): BoxedExpression | undefined;
100
102
  hasKey(_key: string): boolean;
101
- get value(): BoxedExpression | undefined;
102
- set value(_value: BoxedExpression | number | undefined);
103
+ get value(): number | boolean | string | number[] | undefined;
104
+ set value(_value: BoxedExpression | number | boolean | string | number[] | undefined);
103
105
  get domain(): BoxedDomain | undefined;
104
106
  set domain(_domain: BoxedDomain);
105
107
  get isNumber(): boolean | undefined;
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
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';
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { BoxedExpression, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, ReplaceOptions, Substitution, Metadata, PatternMatchOptions, BoxedDomain, BoxedSubstitution } from '../public';
3
3
  import { _BoxedExpression } from './abstract-boxed-expression';
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { BoxedDomain, BoxedExpression, BoxedSubstitution, DomainCompatibility, DomainConstructor, DomainExpression, DomainLiteral, IComputeEngine, Metadata, PatternMatchOptions } from '../public';
3
3
  import { _BoxedExpression } from './abstract-boxed-expression';
4
4
  /**
@@ -12,10 +12,7 @@ export declare class _BoxedDomain extends _BoxedExpression implements BoxedDomai
12
12
  private _hash;
13
13
  readonly base: DomainLiteral;
14
14
  readonly ctor: DomainConstructor | null;
15
- readonly params: BoxedDomain[];
16
- readonly optParams: BoxedDomain[];
17
- readonly restParam: BoxedDomain | null;
18
- readonly result: BoxedDomain | null;
15
+ readonly params: DomainExpression<Expression>[];
19
16
  constructor(ce: IComputeEngine, dom: DomainExpression, metadata?: Metadata);
20
17
  /** Boxed domains are always canonical. */
21
18
  get isCanonical(): boolean;
@@ -34,6 +31,6 @@ export declare class _BoxedDomain extends _BoxedExpression implements BoxedDomai
34
31
  }
35
32
  /** Validate that `expr` is a Domain */
36
33
  export declare function isDomain(expr: Expression | BoxedExpression | BoxedDomain | DomainExpression): expr is BoxedDomain | DomainExpression;
37
- /** Return the ancestor domain that is shared by both `a` and `b` */
34
+ /** Return the ancestor domain (Least Upper Bound) that is shared by both `a` and `b` */
38
35
  export declare function widen(a: BoxedDomain | undefined | null, b: BoxedDomain | undefined | null): BoxedDomain | undefined;
39
36
  export declare function narrow(a: BoxedDomain | undefined, b: BoxedDomain | undefined): BoxedDomain;
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare class _BoxedFunctionDefinition implements BoxedFunctionDefinition {
3
3
  engine: IComputeEngine;
4
4
  scope: RuntimeScope;
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { Expression } from '../../math-json/math-json-format';
3
3
  import { BoxedExpression, BoxedFunctionDefinition, IComputeEngine, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, Substitution, ReplaceOptions, Metadata, PatternMatchOptions, BoxedDomain, RuntimeScope, BoxedSubstitution, EvaluateOptions, BoxedBaseDefinition, Hold } from '../public';
4
4
  /**
@@ -11,8 +11,7 @@ export declare class BoxedFunction extends _BoxedExpression {
11
11
  private _scope;
12
12
  private _def;
13
13
  private _isPure;
14
- private _codomain;
15
- private _value;
14
+ private _result;
16
15
  private _numericValue;
17
16
  private _hash;
18
17
  constructor(ce: IComputeEngine, head: string | BoxedExpression, ops: BoxedExpression[], options?: {
@@ -20,6 +19,7 @@ export declare class BoxedFunction extends _BoxedExpression {
20
19
  canonical?: boolean;
21
20
  });
22
21
  get hash(): number;
22
+ infer(domain: BoxedDomain): boolean;
23
23
  bind(): void;
24
24
  reset(): void;
25
25
  get isCanonical(): boolean;
@@ -48,21 +48,8 @@ export declare class BoxedFunction extends _BoxedExpression {
48
48
  get complexity(): number | undefined;
49
49
  get baseDefinition(): BoxedBaseDefinition | undefined;
50
50
  get functionDefinition(): BoxedFunctionDefinition | undefined;
51
- get value(): BoxedExpression | undefined;
52
51
  /** `isEqual` is mathematical equality */
53
52
  isEqual(rhs: BoxedExpression): boolean;
54
- isLess(rhs: BoxedExpression): boolean | undefined;
55
- isLessEqual(rhs: BoxedExpression): boolean | undefined;
56
- isGreater(rhs: BoxedExpression): boolean | undefined;
57
- isGreaterEqual(rhs: BoxedExpression): boolean | undefined;
58
- get isZero(): boolean | undefined;
59
- get isNotZero(): boolean | undefined;
60
- get isOne(): boolean | undefined;
61
- get isNegativeOne(): boolean | undefined;
62
- get isPositive(): boolean | undefined;
63
- get isNonPositive(): boolean | undefined;
64
- get isNegative(): boolean | undefined;
65
- get isNonNegative(): boolean | undefined;
66
53
  get isNumber(): boolean | undefined;
67
54
  get isInteger(): boolean | undefined;
68
55
  get isRational(): boolean | undefined;
@@ -71,7 +58,6 @@ export declare class BoxedFunction extends _BoxedExpression {
71
58
  get isExtendedReal(): boolean | undefined;
72
59
  get isComplex(): boolean | undefined;
73
60
  get isImaginary(): boolean | undefined;
74
- get sgn(): -1 | 0 | 1 | undefined | null;
75
61
  get domain(): BoxedDomain | undefined;
76
62
  simplify(options?: SimplifyOptions): BoxedExpression;
77
63
  evaluate(options?: EvaluateOptions): BoxedExpression;
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import { Expression } from '../../math-json/math-json-format';
4
4
  import { BoxedExpression, BoxedDomain, IComputeEngine, Metadata, NOptions, PatternMatchOptions, Rational, SimplifyOptions, BoxedSubstitution, EvaluateOptions } from '../public';
@@ -34,7 +34,6 @@ export declare class BoxedNumber extends _BoxedExpression {
34
34
  get isCanonical(): boolean;
35
35
  set isCanonical(val: boolean);
36
36
  get complexity(): number;
37
- get value(): BoxedExpression;
38
37
  get numericValue(): number | Decimal | Complex | Rational;
39
38
  get domain(): BoxedDomain;
40
39
  get json(): Expression;
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { _BoxedExpression } from './abstract-boxed-expression';
3
3
  import { BoxedExpression, BoxedSubstitution, BoxedDomain, IComputeEngine, LatexString, Metadata, Pattern, PatternMatchOptions, SemiBoxedExpression, Substitution } from '../public';
4
4
  export declare class BoxedPattern extends _BoxedExpression implements Pattern {
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { _BoxedExpression } from './abstract-boxed-expression';
3
3
  import { BoxedExpression, BoxedDomain, IComputeEngine, Metadata, PatternMatchOptions, BoxedSubstitution } from '../public';
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  /**
3
3
  * ## THEORY OF OPERATIONS
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import { Expression } from '../../math-json/math-json-format';
4
4
  import { _BoxedExpression } from './abstract-boxed-expression';
@@ -53,8 +53,14 @@ export declare class BoxedSymbol extends _BoxedExpression {
53
53
  * f(x) => x:integer narrowed from integer to real
54
54
  */
55
55
  infer(domain: BoxedDomain): boolean;
56
- get value(): BoxedExpression | undefined;
57
- set value(value: boolean | string | Decimal | Complex | [num: number, denom: number] | BoxedExpression | number | undefined);
56
+ get value(): number | boolean | string | number[] | undefined;
57
+ set value(value: boolean | string | Decimal | Complex | {
58
+ re: number;
59
+ im: number;
60
+ } | {
61
+ num: number;
62
+ denom: number;
63
+ } | number[] | BoxedExpression | number | undefined);
58
64
  get domain(): BoxedDomain | undefined;
59
65
  set domain(inDomain: DomainExpression | BoxedDomain);
60
66
  get sgn(): -1 | 0 | 1 | undefined | null;
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare class ExpressionMap<U> implements ExpressionMapInterface<U> {
3
3
  readonly _items: Map<BoxedExpression, U>;
4
4
  constructor(source?: ExpressionMapInterface<U> | readonly (readonly [BoxedExpression, U])[]);
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export type Order = 'lex' | 'dexlex' | 'grevlex' | 'elim';
3
3
  export declare const DEFAULT_COMPLEXITY = 100000;
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import { Expression } from '../../math-json/math-json-format';
4
4
  import { BoxedExpression, IComputeEngine, Metadata, Rational } from '../public';
@@ -9,7 +9,7 @@ import { BoxedExpression, IComputeEngine, Metadata, Rational } from '../public';
9
9
  * instead of `Multiply`/`Power` when applicable.
10
10
  */
11
11
  export declare function serializeJsonCanonicalFunction(ce: IComputeEngine, head: string | BoxedExpression, args: BoxedExpression[], metadata?: Metadata): Expression;
12
- export declare function serializeJsonFunction(ce: IComputeEngine, head: string | BoxedExpression, args: BoxedExpression[], metadata?: Metadata): Expression;
12
+ export declare function serializeJsonFunction(ce: IComputeEngine, head: string | BoxedExpression, args: (undefined | BoxedExpression)[], metadata?: Metadata): Expression;
13
13
  export declare function serializeJsonString(ce: IComputeEngine, s: string): Expression;
14
14
  export declare function serializeJsonSymbol(ce: IComputeEngine, sym: string, metadata?: Metadata): Expression;
15
15
  export declare function serializeJsonNumber(ce: IComputeEngine, value: number | Decimal | Complex | Rational, metadata?: Metadata): Expression;
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { Expression } from '../../math-json/math-json-format';
3
3
  import { BoxedExpression, IComputeEngine } from '../public';
4
4
  export declare function isLatexString(s: unknown): s is string;
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  /**
3
3
  * Check that the number of arguments is as expected.
4
4
  *
@@ -15,6 +15,8 @@ export declare function checkArity(ce: IComputeEngine, ops: BoxedExpression[], c
15
15
  * and a numeric result), we do a simple numeric check of all arguments, and
16
16
  * verify we have the number of expected arguments.
17
17
  *
18
+ * We also assume that the function is threadable.
19
+ *
18
20
  * Converts the arguments to canonical, and flattens the sequence.
19
21
  */
20
22
  export declare function checkNumericArgs(ce: IComputeEngine, ops: BoxedExpression[], options?: number | {
@@ -36,4 +38,4 @@ export declare function checkArgs(ce: IComputeEngine, args: BoxedExpression[], d
36
38
  * arguments.
37
39
  *
38
40
  */
39
- export declare function adjustArguments(ce: IComputeEngine, ops: BoxedExpression[], hold: Hold, params: BoxedDomain[], optParams: BoxedDomain[], restParam: BoxedDomain | null): BoxedExpression[] | null;
41
+ export declare function adjustArguments(ce: IComputeEngine, ops: BoxedExpression[], hold: Hold, threadable: boolean, params: BoxedDomain[], optParams: BoxedDomain[], restParam: BoxedDomain | undefined): BoxedExpression[] | null;
@@ -0,0 +1,46 @@
1
+ /* 0.19.1 */
2
+ export declare function isCollection(col: BoxedExpression): boolean;
3
+ export declare function isFiniteCollection(col: BoxedExpression): boolean;
4
+ export declare function isIndexableCollection(col: BoxedExpression): boolean;
5
+ export declare function isFiniteIndexableCollection(col: BoxedExpression): boolean;
6
+ /**
7
+ *
8
+ * Iterate over all the elements of a collection. If not a collection,
9
+ * return the expression.
10
+ *
11
+ * The `col` argument is either a collection literal, or a symbol
12
+ * whose value is a collection literal.
13
+ *
14
+ * Even infinite collections are iterable. Use `isFiniteCollection()`
15
+ * to check if the collection is finite.
16
+ *
17
+ * The collection can have one of the following forms:
18
+ * - `["Range"]`, `["Interval"]`, `["Linspace"]` expressions
19
+ * - `["List"]` and `["Set"]` expressions
20
+ * - `["Tuple"]`, `["Pair"]`, `["Pair"]`, `["Triple"]` expressions
21
+ * - `["Sequence"]` expressions
22
+ * ... and more
23
+ *
24
+ * In general, `each` is easier to use than `iterator`, but they do the same
25
+ * thing.
26
+ *
27
+ * @param col - A potential collection
28
+ *
29
+ * @returns
30
+ */
31
+ export declare function each(col: BoxedExpression): Generator<BoxedExpression>;
32
+ /**
33
+ *
34
+ * The `col` argument is either a collection literal, or a symbol
35
+ * whose value is a collection literal.
36
+ *
37
+ * @returns
38
+ */
39
+ export declare function length(col: BoxedExpression): number | undefined;
40
+ /**
41
+ *
42
+ * @param expr
43
+ * @param index 1-based index
44
+ * @returns
45
+ */
46
+ export declare function at(expr: BoxedExpression, index: number): BoxedExpression | undefined;
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { BoxedExpression } from './public';
3
3
  export type CompiledType = boolean | number | string | object;
4
4
  type JSSource = string;
@@ -26,5 +26,5 @@ export declare class ComputeEngineFunction extends Function {
26
26
  }
27
27
  export declare function compileToTarget(expr: BoxedExpression, target: CompileTarget): ((_: Record<string, CompiledType>) => CompiledType) | undefined;
28
28
  export declare function compileToJavascript(expr: BoxedExpression): ((_: Record<string, CompiledType>) => CompiledType) | undefined;
29
- export declare function compile(expr: BoxedExpression, target: CompileTarget, prec?: number): JSSource;
29
+ export declare function compile(expr: BoxedExpression | undefined, target: CompileTarget, prec?: number): JSSource;
30
30
  export {};
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import { Expression, MathJsonNumber } from '../math-json/math-json-format';
4
4
  import type { LibraryCategory, LatexDictionaryEntry, LatexString, NumberFormattingOptions, ParseLatexOptions, SerializeLatexOptions } from './latex-syntax/public';
@@ -361,6 +361,11 @@ export declare class ComputeEngine implements IComputeEngine {
361
361
  * ```
362
362
  */
363
363
  ask(pattern: SemiBoxedExpression): BoxedSubstitution[];
364
+ /**
365
+ * Answer a query based on the current assumptions.
366
+ *
367
+ */
368
+ verify(_query: SemiBoxedExpression): boolean;
364
369
  assume(predicate: SemiBoxedExpression): AssumeResult;
365
370
  forget(symbol: undefined | string | string[]): void;
366
371
  }
@@ -1,3 +1,3 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare function costFunction(expr: BoxedExpression): number;
3
3
  export declare const DEFAULT_COST_FUNCTION: typeof costFunction;
@@ -1,7 +1,18 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { Decimal } from 'decimal.js';
3
- import { DomainLiteral, Rational } from './public';
3
+ import { BoxedDomain, BoxedFunctionSignature, DomainLiteral, FunctionSignature, IComputeEngine, Rational } from './public';
4
4
  /**
5
5
  * Determine the numeric domain of a number.
6
6
  */
7
7
  export declare function inferNumericDomain(value: number | Decimal | Complex | Rational): DomainLiteral;
8
+ /**
9
+ * Extract the parts of a function domain.
10
+ */
11
+ export declare function functionDomain(dom: BoxedDomain): [
12
+ params: BoxedDomain[],
13
+ optParams: BoxedDomain[],
14
+ restParam: BoxedDomain | undefined,
15
+ result: BoxedDomain
16
+ ];
17
+ export declare function domainToSignature(dom: BoxedDomain): Partial<FunctionSignature>;
18
+ export declare function signatureToDomain(ce: IComputeEngine, sig: BoxedFunctionSignature): BoxedDomain;
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  /***
3
3
  * ## THEORY OF OPERATIONS
4
4
  *
@@ -39,27 +39,6 @@
39
39
  * 7/ The result of the function body is returned
40
40
  *
41
41
  */
42
- /**
43
- * From an expression, create an iterator that can be used
44
- * to enumerate values.
45
- *
46
- * `expr` can be a collection, a function, an expression, a string.
47
- *
48
- * - ["Range", 5]
49
- * - ["List", 1, 2, 3]
50
- * - "'hello world'"
51
- *
52
- */
53
- export declare function iterable(expr: BoxedExpression): Iterator<BoxedExpression> | undefined;
54
- /**
55
- * indexable(expr) return a JS function with one argument.
56
- *
57
- * Evaluate expr.
58
- * If expr is indexable function (def with at handler), return handler.
59
- * Otherwise, call makeLambda, then return function that set scope
60
- * with one arg, then evaluate result of makeLambda.
61
- */
62
- export declare function indexable(expr: BoxedExpression): ((index: number) => BoxedExpression | undefined) | undefined;
63
42
  /**
64
43
  * From an expression, return a predicate function, which can be used to filter.
65
44
  */
@@ -1,2 +1,2 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const DEFINITIONS_ALGEBRA: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const DEFINITIONS_ARITHMETIC: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const DEFINITIONS_CALCULUS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const DEFINITIONS_COMPLEX: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const DEFINITIONS_CORE: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const DEFINITIONS_INEQUALITIES: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const DEFINITIONS_LOGIC: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const DEFINITIONS_OTHERS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const DEFINITIONS_SETS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const DEFINITIONS_STATISTICS: LatexDictionary;
@@ -1,3 +1,3 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const SYMBOLS: [string, string, number][];
3
3
  export declare const DEFINITIONS_SYMBOLS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  export declare const DEFINITIONS_TRIGONOMETRY: LatexDictionary;
@@ -1,11 +1,11 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { WarningSignal } from '../../../common/signals';
3
3
  export type CommonEntry = {
4
4
  /** Note: a name is required if a serialize handler is provided */
5
5
  name?: string;
6
6
  serialize?: SerializeHandler;
7
- /** Note: not all kinds have a latexTrigger or identifierTrigger.
8
- * For example, matchfix operators use openDelimiter/closeDelimiter
7
+ /** Note: not all kinds have a `latexTrigger` or `identifierTrigger`.
8
+ * For example, matchfix operators use `openTrigger`/`closeTrigger`
9
9
  */
10
10
  latexTrigger?: LatexString;
11
11
  identifierTrigger?: string;
@@ -40,8 +40,8 @@ export type IndexedFunctionEntry = CommonEntry & {
40
40
  export declare function isIndexedFunctionEntry(entry: IndexedLatexDictionaryEntry): entry is IndexedFunctionEntry;
41
41
  export type IndexedMatchfixEntry = CommonEntry & {
42
42
  kind: 'matchfix';
43
- openDelimiter: Delimiter | LatexToken[];
44
- closeDelimiter: Delimiter | LatexToken[];
43
+ openTrigger: Delimiter | LatexToken[];
44
+ closeTrigger: Delimiter | LatexToken[];
45
45
  parse: MatchfixParseHandler;
46
46
  };
47
47
  /** @internal */
@@ -1,4 +1,4 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { Serializer } from './serializer';
3
3
  import { Expression } from '../../math-json/math-json-format';
4
4
  import { WarningSignalHandler } from '../../common/signals';
@@ -1,8 +1,8 @@
1
- /* 0.18.1 */
1
+ /* 0.19.1 */
2
2
  import { Parser } from './public';
3
3
  /** For error handling, if we have a identifier prefix, assume
4
4
  * the identifier is invalid (it would have been captured by
5
- * `mathIdentifier()` otherwise) and return an error expression */
5
+ * `matchIdentifier()` otherwise) and return an error expression */
6
6
  export declare function parseInvalidIdentifier(parser: Parser): Expression | null;
7
7
  /**
8
8
  * Match an identifier.