@cortex-js/compute-engine 0.35.6 → 0.50.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 (223) hide show
  1. package/README.md +121 -5
  2. package/dist/compute-engine.esm.js +55594 -51135
  3. package/dist/compute-engine.min.esm.js +1081 -78
  4. package/dist/compute-engine.min.umd.js +1081 -78
  5. package/dist/compute-engine.umd.js +53638 -49162
  6. package/dist/math-json.esm.js +2 -2
  7. package/dist/math-json.min.esm.js +2 -2
  8. package/dist/math-json.min.umd.js +2 -2
  9. package/dist/math-json.umd.js +2 -2
  10. package/dist/types/common/ansi-codes.d.ts +1 -1
  11. package/dist/types/common/configuration-change.d.ts +1 -1
  12. package/dist/types/common/fuzzy-string-match.d.ts +1 -1
  13. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  14. package/dist/types/common/interruptible.d.ts +1 -1
  15. package/dist/types/common/one-of.d.ts +1 -1
  16. package/dist/types/common/signals.d.ts +1 -1
  17. package/dist/types/common/type/ast-nodes.d.ts +1 -1
  18. package/dist/types/common/type/boxed-type.d.ts +1 -1
  19. package/dist/types/common/type/lexer.d.ts +1 -1
  20. package/dist/types/common/type/parse.d.ts +1 -1
  21. package/dist/types/common/type/parser.d.ts +8 -1
  22. package/dist/types/common/type/primitive.d.ts +2 -1
  23. package/dist/types/common/type/reduce.d.ts +1 -1
  24. package/dist/types/common/type/serialize.d.ts +1 -1
  25. package/dist/types/common/type/subtype.d.ts +1 -1
  26. package/dist/types/common/type/type-builder.d.ts +1 -1
  27. package/dist/types/common/type/types.d.ts +1 -1
  28. package/dist/types/common/type/utils.d.ts +3 -2
  29. package/dist/types/common/utils.d.ts +1 -1
  30. package/dist/types/compute-engine/assume.d.ts +4 -22
  31. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +66 -76
  32. package/dist/types/compute-engine/boxed-expression/apply.d.ts +4 -4
  33. package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +15 -6
  34. package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +72 -6
  35. package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +8 -8
  36. package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +5 -8
  37. package/dist/types/compute-engine/boxed-expression/box.d.ts +63 -8
  38. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +13 -12
  39. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +44 -43
  40. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +31 -30
  41. package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +18 -18
  42. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +5 -37
  43. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +5 -4
  44. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +34 -33
  45. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +34 -33
  46. package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +8 -8
  47. package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
  48. package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +2 -2
  49. package/dist/types/compute-engine/boxed-expression/canonical.d.ts +2 -2
  50. package/dist/types/compute-engine/boxed-expression/compare.d.ts +7 -4
  51. package/dist/types/compute-engine/boxed-expression/constants.d.ts +6 -0
  52. package/dist/types/compute-engine/boxed-expression/expand.d.ts +4 -5
  53. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +9 -9
  54. package/dist/types/compute-engine/boxed-expression/factor.d.ts +7 -7
  55. package/dist/types/compute-engine/boxed-expression/flatten.d.ts +4 -13
  56. package/dist/types/compute-engine/boxed-expression/hold.d.ts +3 -3
  57. package/dist/types/compute-engine/boxed-expression/inequality-bounds.d.ts +21 -0
  58. package/dist/types/compute-engine/boxed-expression/init-lazy-refs.d.ts +1 -0
  59. package/dist/types/compute-engine/boxed-expression/invisible-operator.d.ts +4 -0
  60. package/dist/types/compute-engine/boxed-expression/match.d.ts +2 -2
  61. package/dist/types/compute-engine/boxed-expression/negate.d.ts +4 -4
  62. package/dist/types/compute-engine/boxed-expression/numerics.d.ts +8 -8
  63. package/dist/types/compute-engine/boxed-expression/order.d.ts +14 -14
  64. package/dist/types/compute-engine/boxed-expression/pattern-utils.d.ts +41 -0
  65. package/dist/types/compute-engine/boxed-expression/polynomial-degree.d.ts +18 -0
  66. package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +12 -35
  67. package/dist/types/compute-engine/boxed-expression/predicates.d.ts +2 -0
  68. package/dist/types/compute-engine/boxed-expression/product.d.ts +1 -66
  69. package/dist/types/compute-engine/boxed-expression/rules.d.ts +51 -51
  70. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +6 -3
  71. package/dist/types/compute-engine/boxed-expression/sgn.d.ts +2 -2
  72. package/dist/types/compute-engine/boxed-expression/simplify.d.ts +2 -2
  73. package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +8 -8
  74. package/dist/types/compute-engine/boxed-expression/solve.d.ts +3 -11
  75. package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +7 -7
  76. package/dist/types/compute-engine/boxed-expression/type-guards.d.ts +31 -0
  77. package/dist/types/compute-engine/boxed-expression/utils.d.ts +13 -13
  78. package/dist/types/compute-engine/boxed-expression/validate.d.ts +10 -10
  79. package/dist/types/compute-engine/collection-utils.d.ts +4 -4
  80. package/dist/types/compute-engine/compilation/base-compiler.d.ts +3 -3
  81. package/dist/types/compute-engine/compilation/compile-expression.d.ts +25 -0
  82. package/dist/types/compute-engine/compilation/glsl-target.d.ts +12 -41
  83. package/dist/types/compute-engine/compilation/gpu-target.d.ts +50 -0
  84. package/dist/types/compute-engine/compilation/interval-glsl-target.d.ts +11 -11
  85. package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +7 -7
  86. package/dist/types/compute-engine/compilation/interval-wgsl-target.d.ts +54 -0
  87. package/dist/types/compute-engine/compilation/javascript-target.d.ts +6 -6
  88. package/dist/types/compute-engine/compilation/python-target.d.ts +61 -0
  89. package/dist/types/compute-engine/compilation/types.d.ts +38 -22
  90. package/dist/types/compute-engine/compilation/wgsl-target.d.ts +41 -0
  91. package/dist/types/compute-engine/cost-function.d.ts +3 -3
  92. package/dist/types/compute-engine/engine-assumptions.d.ts +6 -0
  93. package/dist/types/compute-engine/engine-cache.d.ts +6 -0
  94. package/dist/types/compute-engine/engine-common-symbols.d.ts +6 -0
  95. package/dist/types/compute-engine/engine-compilation-targets.d.ts +17 -0
  96. package/dist/types/compute-engine/engine-configuration-lifecycle.d.ts +15 -0
  97. package/dist/types/compute-engine/engine-declarations.d.ts +19 -0
  98. package/dist/types/compute-engine/engine-expression-entrypoints.d.ts +44 -0
  99. package/dist/types/compute-engine/engine-extension-contracts.d.ts +9 -0
  100. package/dist/types/compute-engine/engine-latex-dictionary-state.d.ts +13 -0
  101. package/dist/types/compute-engine/engine-library-bootstrap.d.ts +6 -0
  102. package/dist/types/compute-engine/engine-numeric-configuration.d.ts +34 -0
  103. package/dist/types/compute-engine/engine-parse-entrypoint.d.ts +7 -0
  104. package/dist/types/compute-engine/engine-runtime-state.d.ts +19 -0
  105. package/dist/types/compute-engine/engine-scope.d.ts +13 -0
  106. package/dist/types/compute-engine/engine-sequences.d.ts +14 -0
  107. package/dist/types/compute-engine/engine-simplification-rules.d.ts +15 -0
  108. package/dist/types/compute-engine/engine-startup-coordinator.d.ts +28 -0
  109. package/dist/types/compute-engine/engine-type-resolver.d.ts +12 -0
  110. package/dist/types/compute-engine/engine-validation-entrypoints.d.ts +13 -0
  111. package/dist/types/compute-engine/free-functions.d.ts +20 -0
  112. package/dist/types/compute-engine/function-utils.d.ts +10 -10
  113. package/dist/types/compute-engine/global-types.d.ts +5 -3301
  114. package/dist/types/compute-engine/index.d.ts +156 -112
  115. package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
  116. package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
  117. package/dist/types/compute-engine/interval/elementary.d.ts +1 -1
  118. package/dist/types/compute-engine/interval/index.d.ts +1 -1
  119. package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -1
  120. package/dist/types/compute-engine/interval/types.d.ts +1 -1
  121. package/dist/types/compute-engine/interval/util.d.ts +1 -1
  122. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  123. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  124. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  125. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  126. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  127. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
  128. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  129. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  130. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
  131. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  132. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  133. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  134. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  135. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +4 -80
  136. package/dist/types/compute-engine/latex-syntax/dictionary/indexed-types.d.ts +83 -0
  137. package/dist/types/compute-engine/latex-syntax/parse-number.d.ts +28 -0
  138. package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +2 -2
  139. package/dist/types/compute-engine/latex-syntax/parse.d.ts +23 -33
  140. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +2 -2
  141. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +8 -8
  142. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +15 -15
  143. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  144. package/dist/types/compute-engine/latex-syntax/types.d.ts +73 -53
  145. package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
  146. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -2
  147. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  148. package/dist/types/compute-engine/library/collections.d.ts +4 -4
  149. package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
  150. package/dist/types/compute-engine/library/complex.d.ts +1 -1
  151. package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
  152. package/dist/types/compute-engine/library/core.d.ts +1 -1
  153. package/dist/types/compute-engine/library/library.d.ts +19 -6
  154. package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
  155. package/dist/types/compute-engine/library/logic-analysis.d.ts +19 -32
  156. package/dist/types/compute-engine/library/logic.d.ts +1 -5
  157. package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
  158. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  159. package/dist/types/compute-engine/library/random-expression.d.ts +2 -2
  160. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
  161. package/dist/types/compute-engine/library/sets.d.ts +1 -1
  162. package/dist/types/compute-engine/library/statistics.d.ts +1 -1
  163. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  164. package/dist/types/compute-engine/library/type-handlers.d.ts +4 -0
  165. package/dist/types/compute-engine/library/utils.d.ts +12 -12
  166. package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +5 -5
  167. package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +5 -5
  168. package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +5 -5
  169. package/dist/types/compute-engine/numeric-value/types.d.ts +2 -3
  170. package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
  171. package/dist/types/compute-engine/numerics/expression.d.ts +3 -3
  172. package/dist/types/compute-engine/numerics/interval.d.ts +2 -2
  173. package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
  174. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
  175. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
  176. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  177. package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
  178. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  179. package/dist/types/compute-engine/numerics/rationals.d.ts +4 -4
  180. package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
  181. package/dist/types/compute-engine/numerics/special-functions.d.ts +120 -1
  182. package/dist/types/compute-engine/numerics/statistics.d.ts +1 -2
  183. package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
  184. package/dist/types/compute-engine/numerics/types.d.ts +3 -1
  185. package/dist/types/compute-engine/oeis.d.ts +3 -3
  186. package/dist/types/compute-engine/sequence.d.ts +13 -13
  187. package/dist/types/compute-engine/symbolic/antiderivative.d.ts +2 -2
  188. package/dist/types/compute-engine/symbolic/derivative.d.ts +3 -3
  189. package/dist/types/compute-engine/symbolic/distribute.d.ts +2 -2
  190. package/dist/types/compute-engine/symbolic/fu-cost.d.ts +6 -6
  191. package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +46 -46
  192. package/dist/types/compute-engine/symbolic/fu.d.ts +4 -4
  193. package/dist/types/compute-engine/symbolic/logic-utils.d.ts +54 -0
  194. package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +4 -4
  195. package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +2 -2
  196. package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +2 -2
  197. package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +2 -2
  198. package/dist/types/compute-engine/symbolic/simplify-log.d.ts +2 -2
  199. package/dist/types/compute-engine/symbolic/simplify-logic.d.ts +5 -0
  200. package/dist/types/compute-engine/symbolic/simplify-power.d.ts +2 -2
  201. package/dist/types/compute-engine/symbolic/simplify-product.d.ts +2 -2
  202. package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +65 -4
  203. package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +2 -2
  204. package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +2 -2
  205. package/dist/types/compute-engine/tensor/tensor-fields.d.ts +42 -42
  206. package/dist/types/compute-engine/tensor/tensors.d.ts +4 -4
  207. package/dist/types/compute-engine/types-definitions.d.ts +900 -0
  208. package/dist/types/compute-engine/types-engine.d.ts +375 -0
  209. package/dist/types/compute-engine/types-evaluation.d.ts +67 -0
  210. package/dist/types/compute-engine/types-expression.d.ts +1655 -0
  211. package/dist/types/compute-engine/types-kernel-evaluation.d.ts +164 -0
  212. package/dist/types/compute-engine/types-kernel-serialization.d.ts +147 -0
  213. package/dist/types/compute-engine/types-serialization.d.ts +23 -0
  214. package/dist/types/compute-engine/types.d.ts +2 -2
  215. package/dist/types/compute-engine.d.ts +16 -3
  216. package/dist/types/math-json/symbols.d.ts +1 -1
  217. package/dist/types/math-json/types.d.ts +3 -3
  218. package/dist/types/math-json/utils.d.ts +31 -31
  219. package/dist/types/math-json.d.ts +2 -2
  220. package/package.json +8 -1
  221. package/dist/types/compute-engine/boxed-expression/terms.d.ts +0 -10
  222. package/dist/types/compute-engine/library/invisible-operator.d.ts +0 -4
  223. package/dist/types/compute-engine/library/logic-utils.d.ts +0 -54
@@ -1,6 +1,6 @@
1
- /* 0.35.6 */
1
+ /* 0.50.1 */
2
2
  import type { Rational } from '../numerics/types';
3
- export declare function asRadical(expr: BoxedExpression): Rational | null;
3
+ export declare function asRadical(expr: Expression): Rational | null;
4
4
  /**
5
5
  *
6
6
  * Produce the canonical form of the operands of a Power expression, returning either the operation
@@ -19,8 +19,8 @@ export declare function asRadical(expr: BoxedExpression): Rational | null;
19
19
  * @param b
20
20
  * @returns
21
21
  */
22
- export declare function canonicalPower(a: BoxedExpression, b: BoxedExpression): BoxedExpression;
23
- export declare function canonicalRoot(a: BoxedExpression, b: BoxedExpression | number): BoxedExpression;
22
+ export declare function canonicalPower(a: Expression, b: Expression): Expression;
23
+ export declare function canonicalRoot(a: Expression, b: Expression | number): Expression;
24
24
  /**
25
25
  * The power function.
26
26
  *
@@ -30,9 +30,9 @@ export declare function canonicalRoot(a: BoxedExpression, b: BoxedExpression | n
30
30
  * See https://docs.sympy.org/latest/modules/core.html#sympy.core.power.Pow
31
31
  *
32
32
  */
33
- export declare function pow(x: BoxedExpression, exp: number | BoxedExpression, { numericApproximation }: {
33
+ export declare function pow(x: Expression, exp: number | Expression, { numericApproximation }: {
34
34
  numericApproximation: boolean;
35
- }): BoxedExpression;
36
- export declare function root(a: BoxedExpression, b: BoxedExpression, { numericApproximation }: {
35
+ }): Expression;
36
+ export declare function root(a: Expression, b: Expression, { numericApproximation }: {
37
37
  numericApproximation: boolean;
38
- }): BoxedExpression;
38
+ }): Expression;
@@ -1,11 +1,8 @@
1
- /* 0.35.6 */
2
- export type AsciiMathSerializer = (expr: BoxedExpression, precedence?: number) => string;
1
+ /* 0.50.1 */
2
+ export type AsciiMathSerializer = (expr: Expression, precedence?: number) => string;
3
3
  export type AsciiMathOptions = {
4
4
  symbols: Record<string, string>;
5
- operators: Record<string, [
6
- string | ((expr: BoxedExpression) => string),
7
- number
8
- ]>;
9
- functions: Record<string, string | ((expr: BoxedExpression, serialize: AsciiMathSerializer) => string)>;
5
+ operators: Record<string, [string | ((expr: Expression) => string), number]>;
6
+ functions: Record<string, string | ((expr: Expression, serialize: AsciiMathSerializer) => string)>;
10
7
  };
11
- export declare function toAsciiMath(expr: BoxedExpression, options?: Partial<AsciiMathOptions>, precedence?: number): string;
8
+ export declare function toAsciiMath(expr: Expression, options?: Partial<AsciiMathOptions>, precedence?: number): string;
@@ -1,6 +1,61 @@
1
- /* 0.35.6 */
2
- import { MathJsonSymbol } from '../../math-json/types';
1
+ /* 0.50.1 */
2
+ import type { FormOption } from '../types-serialization';
3
+ import type { MathJsonSymbol } from '../../math-json/types';
3
4
  import { NumericValue } from '../numeric-value/types';
5
+ /**
6
+ * ### THEORY OF OPERATIONS
7
+ *
8
+ *
9
+ * 1/ The result of boxing is canonical by default.
10
+ *
11
+ * This is the most common need (i.e. to evaluate an expression you need it
12
+ * in canonical form). Creating a boxed expression which is canonical from the
13
+ * start avoid going through an intermediary step with a non-canonical
14
+ * expression.
15
+ *
16
+ * 2/ When boxing (and canonicalizing), if the function is "scoped", a new
17
+ * scope is created before the canonicalization, so that any declaration
18
+ * are done within that scope. Example of scoped functions include `Block`
19
+ * and `Sum`.
20
+ *
21
+ * 3/ When implementing an `evaluate()`:
22
+ * - if `bignumPreferred()` all operations should be done in bignum,
23
+ * otherwise, they should all be done in machine numbers.
24
+ * - if a rational is encountered, preserve it
25
+ * - if a `Sqrt` of a rational is encountered, preserve it
26
+ * - if a `hold` constant is encountered, preserve it
27
+ * - if `numericApproximation` is false and one of the arguments is not exact,
28
+ * return an approximation
29
+ * - if `numericApproximation` is true, always return an approximation
30
+ *
31
+ * NUMERIC APPROXIMATION = FALSE
32
+ * - 2 + 5 -> 7
33
+ * - 2 + 5/7 -> 19/7
34
+ * - 2 + √2 -> 2 + √2
35
+ * - 2 + √(5/7) -> 2 + √(5/7)
36
+ * - 5/7 + 9/11 -> 118/77
37
+ * - 5/7 + √2 -> 5/7 + √2
38
+ * - 10/14 + √(18/9) -> 5/7 + √2
39
+ * - √2 + √5 -> √2 + √5
40
+ * - √2 + √2 -> 2√2
41
+ * - sin(2) -> sin(2)
42
+ * - sin(pi/3) -> √3/2
43
+ * - 2 + 2.1 -> 2 + 2.1
44
+ *
45
+ * NUMERIC APPROXIMATION = TRUE
46
+ * - 2 + 2.1 -> 4.1
47
+ * - 2 + √2.1 -> 3.44914
48
+ * - 5/7 + √2.1 -> 2.16342
49
+ * - sin(2) + √2.1 -> 2.35844
50
+ */
51
+ /**
52
+ * Translate a public `FormOption` to the internal
53
+ * `{ canonical, structural }` representation.
54
+ */
55
+ export declare function formToInternal(form?: FormOption): {
56
+ canonical: CanonicalOptions;
57
+ structural: boolean;
58
+ };
4
59
  /**
5
60
  * Given a name and a set of arguments, return a boxed function expression.
6
61
  *
@@ -8,16 +63,16 @@ import { NumericValue } from '../numeric-value/types';
8
63
  *
9
64
  * Note that `boxFunction()` should only be called from `ce.function()`
10
65
  */
11
- export declare function boxFunction(ce: ComputeEngine, name: MathJsonSymbol, ops: readonly SemiBoxedExpression[], options?: {
66
+ export declare function boxFunction(ce: ComputeEngine, name: MathJsonSymbol, ops: readonly ExpressionInput[], options?: {
12
67
  metadata?: Metadata;
13
68
  canonical?: CanonicalOptions;
14
69
  structural?: boolean;
15
70
  scope?: Scope;
16
- }): BoxedExpression;
71
+ }): Expression;
17
72
  /**
18
73
  * Notes about the boxed form:
19
74
  *
20
- * [1] Expression with an operator of `Number`, `String`, `Symbol` and `Dictionary`
75
+ * [1] MathJsonExpression with an operator of `Number`, `String`, `Symbol` and `Dictionary`
21
76
  * are converted to the corresponding atomic expression.
22
77
  *
23
78
  * [2] Expressions with an operator of `Complex` are converted to a (complex) number
@@ -39,9 +94,9 @@ export declare function boxFunction(ce: ComputeEngine, name: MathJsonSymbol, ops
39
94
  * Note that this function should only be called from `ce.box()`
40
95
  *
41
96
  */
42
- export declare function box(ce: ComputeEngine, expr: null | undefined | NumericValue | SemiBoxedExpression, options?: {
97
+ export declare function box(ce: ComputeEngine, expr: null | undefined | NumericValue | ExpressionInput, options?: {
43
98
  canonical?: CanonicalOptions;
44
99
  structural?: boolean;
45
100
  scope?: Scope;
46
- }): BoxedExpression;
47
- export declare function semiCanonical(ce: ComputeEngine, xs: ReadonlyArray<SemiBoxedExpression>, scope?: Scope): ReadonlyArray<BoxedExpression>;
101
+ }): Expression;
102
+ export declare function semiCanonical(ce: ComputeEngine, xs: ReadonlyArray<ExpressionInput>, scope?: Scope): ReadonlyArray<Expression>;
@@ -1,44 +1,45 @@
1
- /* 0.35.6 */
1
+ /* 0.50.1 */
2
2
  import { _BoxedExpression } from './abstract-boxed-expression';
3
3
  import { BoxedType } from '../../common/type/boxed-type';
4
- import { DictionaryValue, Expression } from '../../math-json/types';
4
+ import { DictionaryValue, MathJsonExpression } from '../../math-json/types';
5
5
  /**
6
6
  * BoxedDictionary
7
7
  *
8
8
  */
9
9
  export declare class BoxedDictionary extends _BoxedExpression implements DictionaryInterface {
10
+ readonly _kind = "dictionary";
10
11
  [Symbol.toStringTag]: string;
11
12
  private readonly _keyValues;
12
13
  private _type;
13
14
  /** The input to the constructor is either a ["Dictionary", ["KeyValuePair", ..., ...], ...] expression or a record of key-value pairs */
14
- constructor(ce: ComputeEngine, keyValues: Record<string, DictionaryValue> | BoxedExpression, options?: {
15
+ constructor(ce: ComputeEngine, keyValues: Record<string, DictionaryValue> | Expression, options?: {
15
16
  metadata?: Metadata;
16
17
  canonical?: boolean;
17
18
  });
18
19
  private _initFromRecord;
19
20
  private _initFromExpression;
20
- get json(): Expression;
21
- toMathJson(options: Readonly<JsonSerializationOptions>): Expression;
21
+ get json(): MathJsonExpression;
22
+ toMathJson(options: Readonly<JsonSerializationOptions>): MathJsonExpression;
22
23
  get hash(): number;
23
24
  get operator(): string;
24
25
  get type(): BoxedType;
25
26
  get isPure(): boolean;
26
27
  get isCanonical(): boolean;
27
28
  set isCanonical(_va: boolean);
28
- get value(): BoxedExpression | undefined;
29
+ get value(): Expression | undefined;
29
30
  get complexity(): number;
30
31
  get isCollection(): boolean;
31
32
  get isIndexedCollection(): boolean;
32
33
  get isLazyCollection(): boolean;
33
- contains(_rhs: BoxedExpression): boolean | undefined;
34
+ contains(_rhs: Expression): boolean | undefined;
34
35
  get count(): number | undefined;
35
36
  get isEmptyCollection(): boolean;
36
37
  get isFiniteCollection(): boolean;
37
- each(): Generator<BoxedExpression>;
38
- get(key: string): BoxedExpression | undefined;
38
+ each(): Generator<Expression>;
39
+ get(key: string): Expression | undefined;
39
40
  has(key: string): boolean;
40
41
  get keys(): string[];
41
- get entries(): [string, BoxedExpression][];
42
- get values(): BoxedExpression[];
43
- match(pattern: BoxedExpression, _options?: PatternMatchOptions): BoxedSubstitution | null;
42
+ get entries(): [string, Expression][];
43
+ get values(): Expression[];
44
+ match(pattern: Expression, _options?: PatternMatchOptions): BoxedSubstitution | null;
44
45
  }
@@ -1,5 +1,5 @@
1
- /* 0.35.6 */
2
- import type { SimplifyOptions, ReplaceOptions, PatternMatchOptions, BoxedExpression, BoxedBaseDefinition, BoxedOperatorDefinition, BoxedRuleSet, BoxedSubstitution, CanonicalOptions, EvaluateOptions, ComputeEngine, Metadata, Rule, Sign, Substitution, Scope, BoxedValueDefinition } from '../global-types';
1
+ /* 0.50.1 */
2
+ import type { SimplifyOptions, ReplaceOptions, PatternMatchOptions, Expression, BoxedBaseDefinition, BoxedOperatorDefinition, BoxedRuleSet, BoxedSubstitution, CanonicalOptions, EvaluateOptions, IComputeEngine as ComputeEngine, Metadata, Rule, Sign, Substitution, Scope, BoxedValueDefinition, FunctionInterface } from '../global-types';
3
3
  import { Type } from '../../common/type/types';
4
4
  import { BoxedType } from '../../common/type/boxed-type';
5
5
  import { NumericValue } from '../numeric-value/types';
@@ -15,7 +15,8 @@ import { _BoxedExpression } from './abstract-boxed-expression';
15
15
  * The definition contains its signature and its evaluation handler.
16
16
  *
17
17
  */
18
- export declare class BoxedFunction extends _BoxedExpression {
18
+ export declare class BoxedFunction extends _BoxedExpression implements FunctionInterface {
19
+ readonly _kind = "function";
19
20
  private readonly _operator;
20
21
  private readonly _ops;
21
22
  private _def;
@@ -33,7 +34,7 @@ export declare class BoxedFunction extends _BoxedExpression {
33
34
  private _valueN;
34
35
  private _sgn;
35
36
  private _type;
36
- constructor(ce: ComputeEngine, operator: string, ops: ReadonlyArray<BoxedExpression>, options?: {
37
+ constructor(ce: ComputeEngine, operator: string, ops: ReadonlyArray<Expression>, options?: {
37
38
  metadata?: Metadata;
38
39
  canonical?: boolean;
39
40
  structural?: boolean;
@@ -47,28 +48,28 @@ export declare class BoxedFunction extends _BoxedExpression {
47
48
  infer(t: Type, inferenceMode?: 'narrow' | 'widen'): boolean;
48
49
  bind(): void;
49
50
  reset(): void;
50
- get value(): BoxedExpression | undefined;
51
+ get value(): Expression | undefined;
51
52
  get isCanonical(): boolean;
52
53
  get isPure(): boolean;
53
54
  get isConstant(): boolean;
54
55
  get constantValue(): number | boolean | string | object | undefined;
55
- get json(): Expression;
56
+ get json(): MathJsonExpression;
56
57
  get operator(): string;
57
- get ops(): ReadonlyArray<BoxedExpression>;
58
+ get ops(): ReadonlyArray<Expression>;
58
59
  get nops(): number;
59
- get op1(): BoxedExpression;
60
- get op2(): BoxedExpression;
61
- get op3(): BoxedExpression;
60
+ get op1(): Expression;
61
+ get op2(): Expression;
62
+ get op3(): Expression;
62
63
  get isScoped(): boolean;
63
64
  get localScope(): Scope | undefined;
64
65
  get isValid(): boolean;
65
66
  /** Note: if the expression is not canonical, this will return a canonical
66
67
  * version of the expression in the current lexical scope.
67
68
  */
68
- get canonical(): BoxedExpression;
69
- get structural(): BoxedExpression;
69
+ get canonical(): Expression;
70
+ get structural(): Expression;
70
71
  get isStructural(): boolean;
71
- toNumericValue(): [NumericValue, BoxedExpression];
72
+ toNumericValue(): [NumericValue, Expression];
72
73
  /**
73
74
  * Note: the result is bound to the current scope, not the scope of the
74
75
  * original expression.
@@ -76,9 +77,9 @@ export declare class BoxedFunction extends _BoxedExpression {
76
77
  */
77
78
  subs(sub: Substitution, options?: {
78
79
  canonical?: CanonicalOptions;
79
- }): BoxedExpression;
80
- replace(rules: BoxedRuleSet | Rule | Rule[], options?: Partial<ReplaceOptions>): BoxedExpression | null;
81
- match(pattern: BoxedExpression, options?: PatternMatchOptions): BoxedSubstitution | null;
80
+ }): Expression;
81
+ replace(rules: BoxedRuleSet | Rule | Rule[], options?: Partial<ReplaceOptions>): Expression | null;
82
+ match(pattern: Expression, options?: PatternMatchOptions): BoxedSubstitution | null;
82
83
  has(v: string | string[]): boolean;
83
84
  get sgn(): Sign | undefined;
84
85
  get isNaN(): boolean | undefined;
@@ -90,19 +91,19 @@ export declare class BoxedFunction extends _BoxedExpression {
90
91
  get isNonNegative(): boolean | undefined;
91
92
  get isNegative(): boolean | undefined;
92
93
  get isNonPositive(): boolean | undefined;
93
- get numerator(): BoxedExpression;
94
- get denominator(): BoxedExpression;
95
- get numeratorDenominator(): [BoxedExpression, BoxedExpression];
96
- neg(): BoxedExpression;
97
- inv(): BoxedExpression;
98
- abs(): BoxedExpression;
99
- add(rhs: number | BoxedExpression): BoxedExpression;
100
- mul(rhs: NumericValue | number | BoxedExpression): BoxedExpression;
101
- div(rhs: number | BoxedExpression): BoxedExpression;
102
- pow(exp: number | BoxedExpression): BoxedExpression;
103
- root(exp: number | BoxedExpression): BoxedExpression;
104
- sqrt(): BoxedExpression;
105
- ln(semiBase?: number | BoxedExpression): BoxedExpression;
94
+ get numerator(): Expression;
95
+ get denominator(): Expression;
96
+ get numeratorDenominator(): [Expression, Expression];
97
+ neg(): Expression;
98
+ inv(): Expression;
99
+ abs(): Expression;
100
+ add(rhs: number | Expression): Expression;
101
+ mul(rhs: NumericValue | number | Expression): Expression;
102
+ div(rhs: number | Expression): Expression;
103
+ pow(exp: number | Expression): Expression;
104
+ root(exp: number | Expression): Expression;
105
+ sqrt(): Expression;
106
+ ln(semiBase?: number | Expression): Expression;
106
107
  get complexity(): number | undefined;
107
108
  get baseDefinition(): BoxedBaseDefinition | undefined;
108
109
  get operatorDefinition(): BoxedOperatorDefinition | undefined;
@@ -111,30 +112,30 @@ export declare class BoxedFunction extends _BoxedExpression {
111
112
  get isInteger(): boolean | undefined;
112
113
  get isRational(): boolean | undefined;
113
114
  get isReal(): boolean | undefined;
114
- get isFunctionExpression(): boolean;
115
+ get isFunctionExpression(): true;
115
116
  /** The type of the value of the function */
116
117
  get type(): BoxedType;
117
118
  /** The shape of the tensor (dimensions), derived from the type */
118
119
  get shape(): number[];
119
120
  /** The rank of the tensor (number of dimensions), derived from the type */
120
121
  get rank(): number;
121
- simplify(options?: Partial<SimplifyOptions>): BoxedExpression;
122
- evaluate(options?: Partial<EvaluateOptions>): BoxedExpression;
123
- evaluateAsync(options?: Partial<EvaluateOptions>): Promise<BoxedExpression>;
124
- N(): BoxedExpression;
125
- solve(vars?: Iterable<string> | string | BoxedExpression | Iterable<BoxedExpression>): null | ReadonlyArray<BoxedExpression> | Record<string, BoxedExpression> | Array<Record<string, BoxedExpression>>;
122
+ simplify(options?: Partial<SimplifyOptions>): Expression;
123
+ evaluate(options?: Partial<EvaluateOptions>): Expression;
124
+ evaluateAsync(options?: Partial<EvaluateOptions>): Promise<Expression>;
125
+ N(): Expression;
126
+ solve(vars?: Iterable<string> | string | Expression | Iterable<Expression>): null | ReadonlyArray<Expression> | Record<string, Expression> | Array<Record<string, Expression>>;
126
127
  get isCollection(): boolean;
127
128
  get isIndexedCollection(): boolean;
128
129
  get isLazyCollection(): boolean;
129
- contains(rhs: BoxedExpression): boolean | undefined;
130
+ contains(rhs: Expression): boolean | undefined;
130
131
  get count(): number | undefined;
131
132
  get isEmptyCollection(): boolean | undefined;
132
133
  get isFiniteCollection(): boolean | undefined;
133
- each(): Generator<BoxedExpression>;
134
- at(index: number): BoxedExpression | undefined;
135
- get(index: BoxedExpression | string): BoxedExpression | undefined;
136
- indexWhere(predicate: (element: BoxedExpression) => boolean): number | undefined;
137
- subsetOf(rhs: BoxedExpression, strict: boolean): boolean;
138
- _computeValue(options?: Partial<EvaluateOptions>): () => BoxedExpression;
139
- _computeValueAsync(options?: Partial<EvaluateOptions>): () => Promise<BoxedExpression>;
134
+ each(): Generator<Expression>;
135
+ at(index: number): Expression | undefined;
136
+ get(index: Expression | string): Expression | undefined;
137
+ indexWhere(predicate: (element: Expression) => boolean): number | undefined;
138
+ subsetOf(rhs: Expression, strict: boolean): boolean;
139
+ _computeValue(options?: Partial<EvaluateOptions>): () => Expression;
140
+ _computeValueAsync(options?: Partial<EvaluateOptions>): () => Promise<Expression>;
140
141
  }
@@ -1,16 +1,17 @@
1
- /* 0.35.6 */
1
+ /* 0.50.1 */
2
2
  import { Decimal } from 'decimal.js';
3
- import type { Expression, MathJsonNumberObject } from '../../math-json';
3
+ import type { MathJsonExpression, MathJsonNumberObject } from '../../math-json';
4
4
  import type { Rational, SmallInteger } from '../numerics/types';
5
5
  import { ExactNumericValueData, NumericValue, NumericValueData } from '../numeric-value/types';
6
6
  import { _BoxedExpression } from './abstract-boxed-expression';
7
7
  import { BoxedType } from '../../common/type/boxed-type';
8
- import type { BoxedRuleSet, BoxedSubstitution, CanonicalOptions, EvaluateOptions, ComputeEngine, Metadata, Rule, Sign, Substitution, BoxedExpression, PatternMatchOptions, ReplaceOptions, SimplifyOptions } from '../global-types';
8
+ import type { BoxedRuleSet, BoxedSubstitution, CanonicalOptions, EvaluateOptions, IComputeEngine as ComputeEngine, Metadata, Rule, Sign, Substitution, Expression, PatternMatchOptions, ReplaceOptions, SimplifyOptions, NumberLiteralInterface } from '../global-types';
9
9
  /**
10
10
  * BoxedNumber
11
11
  *
12
12
  */
13
- export declare class BoxedNumber extends _BoxedExpression {
13
+ export declare class BoxedNumber extends _BoxedExpression implements NumberLiteralInterface {
14
+ readonly _kind = "number";
14
15
  protected readonly _value: SmallInteger | NumericValue;
15
16
  private _hash;
16
17
  /**
@@ -29,7 +30,7 @@ export declare class BoxedNumber extends _BoxedExpression {
29
30
  metadata?: Metadata;
30
31
  });
31
32
  get hash(): number;
32
- get json(): Expression;
33
+ get json(): MathJsonExpression;
33
34
  get operator(): string;
34
35
  get isPure(): boolean;
35
36
  get isCanonical(): boolean;
@@ -48,32 +49,32 @@ export declare class BoxedNumber extends _BoxedExpression {
48
49
  */
49
50
  valueOf(): number | string;
50
51
  get numericValue(): number | NumericValue;
51
- get isNumberLiteral(): boolean;
52
+ get isNumberLiteral(): true;
52
53
  get re(): number;
53
54
  get im(): number;
54
55
  get bignumRe(): Decimal | undefined;
55
56
  get bignumIm(): Decimal | undefined;
56
- neg(): BoxedExpression;
57
- inv(): BoxedExpression;
58
- abs(): BoxedExpression;
59
- add(rhs: number | BoxedExpression): BoxedExpression;
60
- mul(rhs: NumericValue | number | BoxedExpression): BoxedExpression;
61
- div(rhs: number | BoxedExpression): BoxedExpression;
62
- pow(exp: number | BoxedExpression): BoxedExpression;
63
- root(exp: number | BoxedExpression): BoxedExpression;
64
- sqrt(): BoxedExpression;
65
- ln(semiBase?: number | BoxedExpression): BoxedExpression;
66
- get value(): BoxedExpression;
57
+ neg(): Expression;
58
+ inv(): Expression;
59
+ abs(): Expression;
60
+ add(rhs: number | Expression): Expression;
61
+ mul(rhs: NumericValue | number | Expression): Expression;
62
+ div(rhs: number | Expression): Expression;
63
+ pow(exp: number | Expression): Expression;
64
+ root(exp: number | Expression): Expression;
65
+ sqrt(): Expression;
66
+ ln(semiBase?: number | Expression): Expression;
67
+ get value(): Expression;
67
68
  get type(): BoxedType;
68
69
  get sgn(): Sign | undefined;
69
- get numerator(): BoxedExpression;
70
- get denominator(): BoxedExpression;
71
- get numeratorDenominator(): [BoxedExpression, BoxedExpression];
70
+ get numerator(): Expression;
71
+ get denominator(): Expression;
72
+ get numeratorDenominator(): [Expression, Expression];
72
73
  subs(sub: Substitution, options?: {
73
74
  canonical?: CanonicalOptions;
74
- }): BoxedExpression;
75
- replace(rules: BoxedRuleSet | Rule | Rule[], options?: Partial<ReplaceOptions>): BoxedExpression | null;
76
- match(pattern: BoxedExpression, options?: PatternMatchOptions): BoxedSubstitution | null;
75
+ }): Expression;
76
+ replace(rules: BoxedRuleSet | Rule | Rule[], options?: Partial<ReplaceOptions>): Expression | null;
77
+ match(pattern: Expression, options?: PatternMatchOptions): BoxedSubstitution | null;
77
78
  /** x > 0, same as `isGreater(0)` */
78
79
  get isPositive(): boolean | undefined;
79
80
  /** x >= 0, same as `isGreaterEqual(0)` */
@@ -91,13 +92,13 @@ export declare class BoxedNumber extends _BoxedExpression {
91
92
  get isInteger(): boolean;
92
93
  get isRational(): boolean;
93
94
  get isReal(): boolean;
94
- is(other: BoxedExpression | number | bigint | boolean): boolean;
95
- get canonical(): BoxedExpression;
95
+ is(other: Expression | number | bigint | boolean): boolean;
96
+ get canonical(): Expression;
96
97
  get isStructural(): boolean;
97
- get structural(): BoxedExpression;
98
- toNumericValue(): [NumericValue, BoxedExpression];
99
- simplify(options?: Partial<SimplifyOptions>): BoxedExpression;
100
- evaluate(options?: Partial<EvaluateOptions>): BoxedExpression;
101
- N(): BoxedExpression;
98
+ get structural(): Expression;
99
+ toNumericValue(): [NumericValue, Expression];
100
+ simplify(options?: Partial<SimplifyOptions>): Expression;
101
+ evaluate(options?: Partial<EvaluateOptions>): Expression;
102
+ N(): Expression;
102
103
  }
103
104
  export declare function canonicalNumber(ce: ComputeEngine, value: number | bigint | string | Decimal | Complex | Rational | NumericValue | MathJsonNumberObject): number | NumericValue;
@@ -1,6 +1,6 @@
1
- /* 0.35.6 */
1
+ /* 0.50.1 */
2
2
  import { BoxedType } from '../../common/type/boxed-type';
3
- import type { OperatorDefinition, BoxedExpression, BoxedOperatorDefinition, CollectionHandlers, CompiledExpression, EvaluateOptions, ComputeEngine, Sign } from '../global-types';
3
+ import type { OperatorDefinition, Expression, BoxedOperatorDefinition, CollectionHandlers, CompiledExpression, EvaluateOptions, IComputeEngine as ComputeEngine, Sign } from '../global-types';
4
4
  export declare class _BoxedOperatorDefinition implements BoxedOperatorDefinition {
5
5
  engine: ComputeEngine;
6
6
  name: string;
@@ -10,7 +10,7 @@ export declare class _BoxedOperatorDefinition implements BoxedOperatorDefinition
10
10
  broadcastable: boolean;
11
11
  associative: boolean;
12
12
  commutative: boolean;
13
- commutativeOrder: ((a: BoxedExpression, b: BoxedExpression) => number) | undefined;
13
+ commutativeOrder: ((a: Expression, b: Expression) => number) | undefined;
14
14
  idempotent: boolean;
15
15
  involution: boolean;
16
16
  pure: boolean;
@@ -19,34 +19,34 @@ export declare class _BoxedOperatorDefinition implements BoxedOperatorDefinition
19
19
  scoped: boolean;
20
20
  signature: BoxedType;
21
21
  inferredSignature: boolean;
22
- type?: (ops: ReadonlyArray<BoxedExpression>, options: {
22
+ type?: (ops: ReadonlyArray<Expression>, options: {
23
23
  engine: ComputeEngine;
24
24
  }) => BoxedType | Type | TypeString | undefined;
25
- sgn?: (ops: ReadonlyArray<BoxedExpression>, options: {
25
+ sgn?: (ops: ReadonlyArray<Expression>, options: {
26
26
  engine: ComputeEngine;
27
27
  }) => Sign | undefined;
28
- eq?: (a: BoxedExpression, b: BoxedExpression) => boolean | undefined;
29
- neq?: (a: BoxedExpression, b: BoxedExpression) => boolean | undefined;
30
- even?: (ops: ReadonlyArray<BoxedExpression>, options: {
28
+ eq?: (a: Expression, b: Expression) => boolean | undefined;
29
+ neq?: (a: Expression, b: Expression) => boolean | undefined;
30
+ even?: (ops: ReadonlyArray<Expression>, options: {
31
31
  engine: ComputeEngine;
32
32
  }) => boolean | undefined;
33
- canonical?: (ops: ReadonlyArray<BoxedExpression>, options: {
33
+ canonical?: (ops: ReadonlyArray<Expression>, options: {
34
34
  engine: ComputeEngine;
35
- }) => BoxedExpression | null;
36
- evaluate?: (ops: ReadonlyArray<BoxedExpression>, options: Partial<EvaluateOptions> & {
35
+ }) => Expression | null;
36
+ evaluate?: (ops: ReadonlyArray<Expression>, options: Partial<EvaluateOptions> & {
37
37
  engine: ComputeEngine;
38
- }) => BoxedExpression | undefined;
39
- evaluateAsync?: (ops: ReadonlyArray<BoxedExpression>, options?: Partial<EvaluateOptions> & {
38
+ }) => Expression | undefined;
39
+ evaluateAsync?: (ops: ReadonlyArray<Expression>, options?: Partial<EvaluateOptions> & {
40
40
  engine?: ComputeEngine;
41
- }) => Promise<BoxedExpression | undefined>;
42
- evalDimension?: (ops: ReadonlyArray<BoxedExpression>, options: {
41
+ }) => Promise<Expression | undefined>;
42
+ evalDimension?: (ops: ReadonlyArray<Expression>, options: {
43
43
  engine: ComputeEngine;
44
- }) => BoxedExpression;
45
- compile?: (expr: BoxedExpression) => CompiledExpression;
44
+ }) => Expression;
45
+ compile?: (expr: Expression) => CompiledExpression;
46
46
  collection?: CollectionHandlers;
47
47
  constructor(ce: ComputeEngine, name: string, def: OperatorDefinition);
48
48
  /** For debugging */
49
- toJSON(): any;
49
+ toJSON(): Record<string, unknown>;
50
50
  infer(sig: Type): void;
51
51
  update(def: OperatorDefinition): void;
52
52
  onConfigurationChange(): void;
@@ -1,4 +1,4 @@
1
- /* 0.35.6 */
1
+ /* 0.50.1 */
2
2
  * # Pattern Matching Wildcards
3
3
  *
4
4
  * Patterns can contain wildcards that match parts of expressions. There are
@@ -53,41 +53,9 @@
53
53
  *
54
54
  * @module boxed-patterns
55
55
  */
56
- import type { BoxedSymbol } from './boxed-symbol';
57
- import type { BoxedExpression } from '../global-types';
58
- /**
59
- * Check if an expression is a wildcard (universal, sequence, or optional sequence).
60
- *
61
- * @param expr - The expression to check
62
- * @returns `true` if the expression is any type of wildcard
63
- */
64
- export declare function isWildcard(expr: BoxedExpression): expr is BoxedSymbol;
65
- /**
66
- * Get the string representation of a wildcard expression.
67
- *
68
- * Returns the wildcard symbol including its name (if any):
69
- * - `'_'` for anonymous universal wildcard
70
- * - `'_a'` for named universal wildcard
71
- * - `'__'` for anonymous sequence wildcard
72
- * - `'__args'` for named sequence wildcard
73
- * - `'___'` for anonymous optional sequence wildcard
74
- * - `'___rest'` for named optional sequence wildcard
75
- *
76
- * @param expr - The expression to get the wildcard name from
77
- * @returns The wildcard string, or `null` if not a wildcard
78
- */
79
- export declare function wildcardName(expr: BoxedExpression): string | null;
80
- /**
81
- * Determine the type of wildcard.
82
- *
83
- * @param expr - A BoxedExpression or wildcard symbol string
84
- * @returns
85
- * - `'Wildcard'` - Universal wildcard (`_` or `_name`), matches exactly one element
86
- * - `'Sequence'` - Sequence wildcard (`__` or `__name`), matches one or more elements
87
- * - `'OptionalSequence'` - Optional sequence (`___` or `___name`), matches zero or more elements
88
- * - `null` - Not a wildcard
89
- */
90
- export declare function wildcardType(expr: BoxedExpression | string): 'Wildcard' | 'Sequence' | 'OptionalSequence' | null;
56
+ import type { Expression } from '../global-types';
57
+ import { isWildcard, wildcardName, wildcardType } from './pattern-utils';
58
+ export { isWildcard, wildcardName, wildcardType };
91
59
  /**
92
60
  * Validate a pattern for invalid wildcard combinations.
93
61
  *
@@ -104,4 +72,4 @@ export declare function wildcardType(expr: BoxedExpression | string): 'Wildcard'
104
72
  * @param pattern - The pattern to validate
105
73
  * @throws Error if the pattern contains invalid wildcard combinations
106
74
  */
107
- export declare function validatePattern(pattern: BoxedExpression): void;
75
+ export declare function validatePattern(pattern: Expression): void;
@@ -1,11 +1,12 @@
1
- /* 0.35.6 */
1
+ /* 0.50.1 */
2
2
  import { _BoxedExpression } from './abstract-boxed-expression';
3
3
  import { BoxedType } from '../../common/type/boxed-type';
4
4
  /**
5
5
  * BoxedString
6
6
  *
7
7
  */
8
- export declare class BoxedString extends _BoxedExpression {
8
+ export declare class BoxedString extends _BoxedExpression implements StringInterface {
9
+ readonly _kind = "string";
9
10
  [Symbol.toStringTag]: string;
10
11
  private readonly _string;
11
12
  private _utf8Buffer?;
@@ -17,11 +18,11 @@ export declare class BoxedString extends _BoxedExpression {
17
18
  get isPure(): boolean;
18
19
  get isCanonical(): boolean;
19
20
  set isCanonical(_va: boolean);
20
- get value(): BoxedExpression;
21
+ get value(): Expression;
21
22
  get type(): BoxedType;
22
23
  get complexity(): number;
23
24
  get string(): string;
24
25
  get buffer(): Uint8Array;
25
26
  get unicodeScalars(): number[];
26
- match(pattern: BoxedExpression, _options?: PatternMatchOptions): BoxedSubstitution | null;
27
+ match(pattern: Expression, _options?: PatternMatchOptions): BoxedSubstitution | null;
27
28
  }