@cortex-js/compute-engine 0.8.0 → 0.9.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 (83) hide show
  1. package/dist/compute-engine.esm.js +7800 -6891
  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 +41 -88
  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 -5
  9. package/dist/types/common/utils.d.ts +1 -0
  10. package/dist/types/compute-engine/assume.d.ts +6 -1
  11. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +10 -14
  12. package/dist/types/compute-engine/boxed-expression/box.d.ts +74 -16
  13. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +10 -5
  14. package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +3 -4
  15. package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +1 -1
  16. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +16 -14
  17. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +20 -19
  18. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +8 -7
  19. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +3 -3
  20. package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +1 -1
  21. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +18 -12
  22. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  23. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  24. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +3 -3
  25. package/dist/types/compute-engine/boxed-expression/utils.d.ts +7 -7
  26. package/dist/types/compute-engine/boxed-expression/validate.d.ts +18 -0
  27. package/dist/types/compute-engine/compute-engine.d.ts +64 -33
  28. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  29. package/dist/types/compute-engine/domain-utils.d.ts +2 -8
  30. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  31. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  32. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  33. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  34. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-inequalities.d.ts +1 -1
  35. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  36. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  37. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  38. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  39. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  40. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
  41. package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
  42. package/dist/types/compute-engine/latex-syntax/parse.d.ts +25 -9
  43. package/dist/types/compute-engine/latex-syntax/public.d.ts +14 -6
  44. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
  45. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +2 -2
  46. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +2 -2
  47. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  48. package/dist/types/compute-engine/library/arithmetic-add.d.ts +3 -3
  49. package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
  50. package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +5 -6
  51. package/dist/types/compute-engine/library/arithmetic-power.d.ts +3 -2
  52. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
  53. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  54. package/dist/types/compute-engine/library/collections.d.ts +1 -1
  55. package/dist/types/compute-engine/library/core.d.ts +1 -1
  56. package/dist/types/compute-engine/library/domains.d.ts +1 -1
  57. package/dist/types/compute-engine/library/library.d.ts +1 -1
  58. package/dist/types/compute-engine/library/logic.d.ts +1 -1
  59. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  60. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
  61. package/dist/types/compute-engine/library/sets.d.ts +1 -1
  62. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  63. package/dist/types/compute-engine/numerics/{numeric-decimal.d.ts → numeric-bignum.d.ts} +10 -6
  64. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  65. package/dist/types/compute-engine/numerics/numeric.d.ts +10 -6
  66. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  67. package/dist/types/compute-engine/numerics/rationals.d.ts +56 -0
  68. package/dist/types/compute-engine/public.d.ts +200 -247
  69. package/dist/types/compute-engine/rules.d.ts +7 -1
  70. package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
  71. package/dist/types/compute-engine/solve.d.ts +17 -0
  72. package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
  73. package/dist/types/compute-engine/symbolic/flatten.d.ts +2 -1
  74. package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
  75. package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
  76. package/dist/types/compute-engine/symbolic/product.d.ts +30 -12
  77. package/dist/types/compute-engine/symbolic/sum.d.ts +13 -7
  78. package/dist/types/compute-engine/symbolic/utils.d.ts +7 -29
  79. package/dist/types/compute-engine.d.ts +2 -2
  80. package/dist/types/math-json/math-json-format.d.ts +2 -2
  81. package/dist/types/math-json/utils.d.ts +11 -41
  82. package/dist/types/math-json.d.ts +3 -3
  83. package/package.json +1 -1
@@ -1,4 +1,10 @@
1
- /* 0.8.0 */
1
+ /* 0.9.0 */
2
+ /**
3
+ * Go through all the rules in the rule set, and for all the rules that match
4
+ * return the rhs of the rule applied to `expr`.
5
+ * @param rules
6
+ */
7
+ export declare function matchRules(expr: BoxedExpression, rules: BoxedRuleSet, sub: BoxedSubstitution): BoxedExpression[];
2
8
  export declare function boxRules(ce: IComputeEngine, rs: Iterable<Rule>): BoxedRuleSet;
3
9
  /**
4
10
  * Apply the rules in the ruleset and return a modified expression.
@@ -1,4 +1,4 @@
1
- /* 0.8.0 */
1
+ /* 0.9.0 */
2
2
  /**
3
3
  * A set of simplification rules.
4
4
  *
@@ -0,0 +1,17 @@
1
+ /* 0.9.0 */
2
+ export declare const UNIVARIATE_ROOTS: Rule[];
3
+ /**
4
+ * Expression is a function of a single variable (`x`) or an Equality
5
+ *
6
+ * Return the roots of that variable
7
+ *
8
+ */
9
+ export declare function findUnivariateRoots(expr: BoxedExpression, x: string): BoxedExpression[];
10
+ /** Expr is an equation with a head of
11
+ * - `Equal`, `Less`, `Greater`, `LessEqual`, `GreaterEqual`
12
+ *
13
+ * Return an expression with the same head, but with the first argument
14
+ * a variable, if possible:
15
+ * `2x < 4` => `x < 2`
16
+ */
17
+ export declare function univariateSolve(expr: BoxedExpression, x: string): SemiBoxedExpression[] | null;
@@ -1,4 +1,4 @@
1
- /* 0.8.0 */
1
+ /* 0.9.0 */
2
2
  /**
3
3
  * Return the expansion of ['Multiply', lhs, rhs]
4
4
  * - lhs = 'a + b', rhs = '2'
@@ -1,7 +1,8 @@
1
- /* 0.8.0 */
1
+ /* 0.9.0 */
2
2
  /**
3
3
  * Flatten the arguments.
4
4
  * If `expr` was canonical, the result it canonical.
5
5
  */
6
6
  export declare function flatten(expr: BoxedExpression, head: string): BoxedExpression;
7
7
  export declare function flattenOps(ops: BoxedExpression[], head: string): BoxedExpression[] | null;
8
+ export declare function flattenSequence(xs: BoxedExpression[]): BoxedExpression[];
@@ -1,4 +1,4 @@
1
- /* 0.8.0 */
1
+ /* 0.9.0 */
2
2
  /**
3
3
  * Distribute `Negate` (multiply by -1) if expr is a number literal, an
4
4
  * addition or another `Negate`.
@@ -1,4 +1,4 @@
1
- /* 0.8.0 */
1
+ /* 0.9.0 */
2
2
  /**
3
3
  * Coefficient of a univariate (single variable) polynomial.
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.8.0 */
1
+ /* 0.9.0 */
2
2
  /**
3
3
  * Group terms in a product by common term.
4
4
  *
@@ -17,29 +17,47 @@
17
17
  */
18
18
  export declare class Product {
19
19
  engine: IComputeEngine;
20
+ private _sign;
21
+ private _rational;
22
+ private _complex;
23
+ private _bignum;
24
+ private _number;
20
25
  private _terms;
21
- private _literal;
22
26
  private _hasInfinity;
23
27
  private _hasZero;
24
- constructor(ce: IComputeEngine, xs?: BoxedExpression[]);
28
+ private _isCanonical;
29
+ constructor(ce: IComputeEngine, xs?: BoxedExpression[], options?: {
30
+ canonical?: boolean;
31
+ });
25
32
  get isEmpty(): boolean;
26
33
  /**
27
34
  * Add a term to the product.
28
- * If the term is a literal rational, it is added to `this._literal`.
29
- * Otherwise, if the term is already in the product, its degree is modified
30
- * as appropriate.
35
+ *
36
+ * If `this._isCanonical` a running product of exact terms is kept.
37
+ * Otherwise, terms and their exponent are tallied.
31
38
  */
32
39
  addTerm(term: BoxedExpression): void;
33
- /** The terms of the product, grouped by degrees */
40
+ unitTerms(mode: 'rational' | 'expression' | 'numeric'): {
41
+ exponent: Rational;
42
+ terms: BoxedExpression[];
43
+ }[] | null;
44
+ /** The terms of the product, grouped by degrees.
45
+ *
46
+ * If `mode` is `rational`, rationals are split into separate numerator and
47
+ * denominator, so that a rational expression can be created later
48
+ * If `mode` is `expression`, a regular expression is returned, without
49
+ * splitting rationals
50
+ * If `mode` is `numeric`, the literals are combined into one expression
51
+ *
52
+ */
34
53
  groupedByDegrees(options?: {
35
- splitRational: boolean;
54
+ mode?: 'rational' | 'expression' | 'numeric';
36
55
  }): {
37
- exponent: [exponentNumer: number, exponentDenom: number];
56
+ exponent: Rational;
38
57
  terms: BoxedExpression[];
39
- }[];
40
- terms(): BoxedExpression[];
58
+ }[] | null;
59
+ asExpression(mode?: 'N' | 'evaluate'): BoxedExpression;
41
60
  /** The product, expressed as a numerator and denominator */
42
61
  asNumeratorDenominator(): [BoxedExpression, BoxedExpression];
43
- asExpression(): BoxedExpression;
44
62
  asRationalExpression(): BoxedExpression;
45
63
  }
@@ -1,15 +1,21 @@
1
- /* 0.8.0 */
1
+ /* 0.9.0 */
2
2
  export declare class Sum {
3
3
  private engine;
4
- private _literal;
4
+ private _rational;
5
5
  private _imaginary;
6
+ private _number;
7
+ private _bignum;
6
8
  private _posInfinityCount;
7
9
  private _negInfinityCount;
8
10
  private _terms;
9
- constructor(engine: IComputeEngine, terms?: BoxedExpression[]);
11
+ private _isCanonical;
12
+ constructor(ce: IComputeEngine, xs?: BoxedExpression[], options?: {
13
+ canonical?: boolean;
14
+ });
10
15
  get isEmpty(): boolean;
11
16
  /**
12
- * Add a new term to the sum.
17
+ * Add a term to the sum.
18
+ *
13
19
  * A term is a rational coefficient and an expression.
14
20
  * Optionally, the term is multiplied by the constant `c` before being added.
15
21
  *
@@ -19,7 +25,7 @@ export declare class Sum {
19
25
  * E.g. "2x + x + 1/5 y"
20
26
  * -> [['x', [3, 1]], ['y', [1, 5]]]
21
27
  */
22
- addTerm(term: BoxedExpression, c?: [number, number]): void;
23
- terms(): BoxedExpression[];
24
- asExpression(): BoxedExpression;
28
+ addTerm(term: BoxedExpression, c?: Rational): void;
29
+ terms(mode: 'expression' | 'numeric'): BoxedExpression[];
30
+ asExpression(mode: 'expression' | 'numeric'): BoxedExpression;
25
31
  }
@@ -1,30 +1,9 @@
1
- /* 0.8.0 */
2
- /**
3
- * If expression is a product or a division, collect all the terms with a
4
- * negative exponents in the denominator, and all the terms
5
- * with a positive exponent (or no exponent) in the numerator, and put the
6
- * numerator and denominators of all the terms that are a division (or a rational)
7
- * into separate numerator/denominator
8
- */
9
- export declare function numeratorDenominator(expr: BoxedExpression): [SemiBoxedExpression[], SemiBoxedExpression[]];
10
- /**
11
- * Attempt to factor a rational coefficient `c` and a `rest` out of a
12
- * canonical expression `expr` such that `ce.mul(c, rest)` is equal to `expr`.
13
- *
14
- * Attempts to make `rest` a positive value (i.e. pulls out negative sign).
15
- *
16
- *
17
- * ['Multiply', 2, 'x', 3, 'a', ['Sqrt', 5]]
18
- * -> [[6, 1], ['Multiply', 'x', 'a', ['Sqrt', 5]]]
19
- *
20
- * ['Divide', ['Multiply', 2, 'x'], ['Multiply', 3, 'y', 'a']]
21
- * -> [[2, 3], ['Divide', 'x', ['Multiply, 'y', 'a']]]
22
- */
23
- export declare function asCoefficient(expr: BoxedExpression): [coef: [numer: number, denom: number], rest: BoxedExpression];
1
+ /* 0.9.0 */
2
+ import Decimal from 'decimal.js';
3
+ import { BoxedExpression, Rational } from '../public';
24
4
  /**
25
5
  * Return a rational coef and constant such that `coef * mod + constant = expr`
26
6
  */
27
- export declare function multiple(expr: BoxedExpression, mod: BoxedExpression): [coef: [number, number], constant: BoxedExpression];
28
7
  /**
29
8
  * Return a coef, term and constant such that:
30
9
  *
@@ -32,11 +11,6 @@ export declare function multiple(expr: BoxedExpression, mod: BoxedExpression): [
32
11
  *
33
12
  * Return null if no `coef`/`constant` can be found.
34
13
  */
35
- export declare function linear(expr: BoxedExpression): null | {
36
- coef: [number, number];
37
- term: BoxedExpression;
38
- constant: [number, number];
39
- };
40
14
  /**
41
15
  * Apply the operator `op` to the left-hand-side and right-hand-side
42
16
  * expression. Applies the associativity rule specified by the definition,
@@ -45,3 +19,7 @@ export declare function linear(expr: BoxedExpression): null | {
45
19
  */
46
20
  export declare function applyAssociativeOperator(op: string, lhs: BoxedExpression, rhs: BoxedExpression, associativity?: 'right' | 'left' | 'non' | 'both'): BoxedExpression;
47
21
  export declare function makePositive(expr: BoxedExpression): [sign: number, expr: BoxedExpression];
22
+ export declare function apply(expr: BoxedExpression, fn: (x: number) => number | Complex, bigFn?: (x: Decimal) => Decimal | Complex | number, complexFn?: (x: Complex) => number | Complex): number | Decimal | Complex;
23
+ export declare function applyN(expr: BoxedExpression, fn: (x: number) => number | Complex, bigFn?: (x: Decimal) => Decimal | Complex | number, complexFn?: (x: Complex) => number | Complex): BoxedExpression | undefined;
24
+ export declare function apply2(expr1: BoxedExpression, expr2: BoxedExpression, fn: (x1: number, x2: number) => number | Complex | Rational, bigFn?: (x1: Decimal, x2: Decimal) => Decimal | Complex | Rational | number, complexFn?: (x1: Complex, x2: number | Complex) => Complex | number): number | Decimal | Complex | Rational;
25
+ export declare function apply2N(expr1: BoxedExpression, expr2: BoxedExpression, fn: (x1: number, x2: number) => number | Complex | Rational, bigFn?: (x1: Decimal, x2: Decimal) => Decimal | Complex | number | Rational, complexFn?: (x1: Complex, x2: number | Complex) => Complex | number): BoxedExpression | undefined;
@@ -1,4 +1,4 @@
1
- /* 0.8.0 */
1
+ /* 0.9.0 */
2
2
  export { ComputeEngine } from './compute-engine/compute-engine';
3
- export declare const version = "0.8.0";
3
+ export declare const version = "0.9.0";
4
4
  export { getVars } from './compute-engine/boxed-expression/utils';
@@ -1,4 +1,4 @@
1
- /* 0.8.0 */
1
+ /* 0.9.0 */
2
2
  /** A human readable string to annotate this expression, since JSON does not
3
3
  * allow comments in its encoding */
4
4
  comment?: string;
@@ -102,4 +102,4 @@ export declare type MathJsonDictionary = {
102
102
  * The dictionary and function nodes can contain expressions themselves.
103
103
  *
104
104
  */
105
- export declare type Expression = number | MathJsonNumber | MathJsonString | MathJsonSymbol | string | MathJsonFunction | MathJsonDictionary | [Expression, ...Expression[]];
105
+ export declare type Expression = number | string | MathJsonNumber | MathJsonString | MathJsonSymbol | MathJsonFunction | MathJsonDictionary | [Expression, ...Expression[]];
@@ -1,46 +1,19 @@
1
- /* 0.8.0 */
2
- /**
3
- * These constants are the 'primitive' functions and constants that are used
4
- * for some basic manipulations such as parsing, and transforming to canonical
5
- * form.
6
- *
7
- */
8
- export declare const IDENTITY = "Identity";
9
- export declare const LIST = "List";
10
- export declare const ADD = "Add";
11
- export declare const DERIVATIVE = "Derivative";
12
- export declare const DIVIDE = "Divide";
13
- export declare const EXP = "Exp";
14
- export declare const MULTIPLY = "Multiply";
15
- export declare const NEGATE = "Negate";
16
- export declare const POWER = "Power";
17
- export declare const PRIME = "Prime";
18
- export declare const ROOT = "Root";
19
- export declare const SQRT = "Sqrt";
20
- export declare const SUBTRACT = "Subtract";
21
- export declare const COMPLEX_INFINITY = "ComplexInfinity";
22
- export declare const PI = "Pi";
23
- export declare const EXPONENTIAL_E = "ExponentialE";
24
- export declare const IMAGINARY_UNIT = "ImaginaryUnit";
1
+ /* 0.9.0 */
25
2
  export declare function isNumberObject(expr: Expression | null): expr is MathJsonNumber;
26
3
  export declare function isSymbolObject(expr: Expression | null): expr is MathJsonSymbol;
27
4
  export declare function isStringObject(expr: Expression | null): expr is MathJsonString;
28
5
  export declare function isFunctionObject(expr: Expression | null): expr is MathJsonFunction;
29
6
  export declare function isDictionaryObject(expr: Expression): expr is MathJsonNumber;
30
- /**
31
- * True if the expression is a number, a symbol or a string
32
- * (i.e. not a function and not a dictionary)
33
- */
34
- export declare function isAtomic(expr: Expression | null): boolean;
35
- export declare function isValidSymbolName(s: string): boolean;
7
+ export declare function isValidIdentifier(s: string): boolean;
36
8
  /** If expr is a string literal, return it.
37
9
  *
38
10
  * A string literal is a JSON string that begins and ends with
39
11
  * **U+0027 APOSTROPHE** : **`'`** or an object literal with a `str` key.
40
12
  */
41
13
  export declare function stringValue(expr: Expression | null | undefined): string | null;
14
+ export declare function stripText(expr: Expression | null | undefined): Expression | null;
42
15
  /**
43
- * The head of a function can be a string or an expression.
16
+ * The head of a function can be an identifier or an expression.
44
17
  *
45
18
  * Return `null` if the expression is not a function.
46
19
  *
@@ -51,12 +24,13 @@ export declare function stringValue(expr: Expression | null | undefined): string
51
24
  export declare function head(expr: Expression | null | undefined): Expression | null;
52
25
  /** Return the head of an expression, only if it's a string */
53
26
  export declare function headName(expr: Expression | null): string;
54
- export declare function op(expr: Expression | null | undefined, n: number): Expression | null;
55
27
  /**
56
28
  * Return all the elements but the first one, i.e. the arguments of a
57
29
  * function.
58
30
  */
59
31
  export declare function ops(expr: Expression | null | undefined): Expression[] | null;
32
+ /** Return the nth argument of a function expression */
33
+ export declare function op(expr: Expression | null | undefined, n: number): Expression | null;
60
34
  export declare function op1(expr: Expression | null | undefined): Expression | null;
61
35
  export declare function op2(expr: Expression | null | undefined): Expression | null;
62
36
  export declare function nops(expr: Expression | null | undefined): number;
@@ -65,7 +39,7 @@ export declare function dictionary(expr: Expression | null): null | Record<strin
65
39
  export declare function machineValue(expr: Expression | null | undefined): number | null;
66
40
  /**
67
41
  * Return a rational (numer over denom) representation of the expression,
68
- * if possible, `[null, null]` otherwise.
42
+ * if possible, `null` otherwise.
69
43
  *
70
44
  * The expression can be:
71
45
  * - Some symbols: "Infinity", "Half"...
@@ -75,8 +49,8 @@ export declare function machineValue(expr: Expression | null | undefined): numbe
75
49
  *
76
50
  * The denominator is always > 0.
77
51
  */
78
- export declare function rationalValue(expr: Expression | undefined | null): [number, number] | [null, null];
79
- export declare function applyRecursively(expr: Expression, fn: (x: Expression) => Expression): Expression;
52
+ export declare function rationalValue(expr: Expression | undefined | null): [number, number] | null;
53
+ export declare function applyRecursively<T extends Expression = Expression>(expr: T, fn: (x: T) => T): Expression;
80
54
  export declare function subs(expr: Expression, s: {
81
55
  [symbol: string]: Expression;
82
56
  }): Expression;
@@ -84,12 +58,6 @@ export declare function subs(expr: Expression, s: {
84
58
  * Apply a function to the arguments of a function and return an array of T
85
59
  */
86
60
  export declare function mapArgs<T>(expr: Expression, fn: (x: Expression) => T): T[];
87
- /**
88
- * Return num as a number if it's a valid JSON number (that is
89
- * a valid JavaScript number but not NaN or +/-Infinity) or
90
- * as a string otherwise
91
- */
92
- export declare function asValidJSONNumber(num: string): string | number;
93
61
  /**
94
62
  * Apply the operator `op` to the left-hand-side and right-hand-side
95
63
  * expression. Applies the associativity rule specified by the definition,
@@ -100,3 +68,5 @@ export declare function applyAssociativeOperator(op: string, lhs: Expression, rh
100
68
  export declare function getSequence(expr: Expression | null): Expression[] | null;
101
69
  export declare function isEmptySequence(expr: Expression | null): boolean;
102
70
  export declare function missingIfEmpty(expr: Expression | null): Expression;
71
+ /** The number of leaves (atomic expressions) in the expression */
72
+ export declare function countLeaves(expr: Expression | null): number;
@@ -1,4 +1,4 @@
1
- /* 0.8.0 */
2
- export { isAtomic, isSymbolObject, isStringObject, isFunctionObject, isDictionaryObject, stringValue as getStringValue, head, headName, symbol, applyRecursively, mapArgs, op, nops, dictionary as getDictionary, asValidJSONNumber, } from './math-json/utils';
1
+ /* 0.9.0 */
2
+ export { isSymbolObject, isStringObject, isFunctionObject, isDictionaryObject, stringValue as getStringValue, head, headName, symbol, applyRecursively, mapArgs, op, nops, dictionary as getDictionary, } from './math-json/utils';
3
3
  export type { LatexToken, ParseHandler, SerializeHandler, LatexDictionaryEntry, LatexDictionary, ParseLatexOptions, SerializeLatexOptions, NumberFormattingOptions, } from './compute-engine/latex-syntax/public';
4
- export declare const version = "0.8.0";
4
+ export declare const version = "0.9.0";
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.8.0",
2
+ "version": "0.9.0",
3
3
  "scripts": {
4
4
  "build": "bash ./scripts/build.sh",
5
5
  "clean": "bash ./scripts/clean.sh",