Skip to content

Commit 3f67e02

Browse files
committed
arch: the great renaming phase 3
1 parent 1d40f21 commit 3f67e02

15 files changed

Lines changed: 48 additions & 48 deletions

test/compute-engine/benchmarks/expand.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { BoxedExpression } from '../../../src/compute-engine/public';
1+
import type { Expression } from '../../../src/compute-engine/public';
22
import { benchmark, engine } from '../../utils';
33

44
//
55
// Expand Benchmark
66
//
77

8-
function expand(e: BoxedExpression): BoxedExpression {
8+
function expand(e: Expression): Expression {
99
return engine.box(['Expand', e]).evaluate();
1010
}
1111

test/compute-engine/benchmarks/grudnitski.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { BoxedExpression, ComputeEngine } from '../../../src/compute-engine';
1+
import { Expression, ComputeEngine } from '../../../src/compute-engine';
22

33
export const ce = new ComputeEngine();
44

5-
function isEquivalent(a: string | BoxedExpression, b: string): boolean {
5+
function isEquivalent(a: string | Expression, b: string): boolean {
66
const lhs = typeof a === 'string' ? ce.parse(a) : a;
77
return lhs.isSame(ce.parse(b));
88
}
99

10-
function isEquivalentSimplify(a: string | BoxedExpression, b: string): boolean {
10+
function isEquivalentSimplify(a: string | Expression, b: string): boolean {
1111
const lhs = typeof a === 'string' ? ce.parse(a) : a;
1212
return lhs.simplify().isSame(ce.parse(b).simplify());
1313
}

test/compute-engine/canonical-form.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ describe('CANONICAL FORMS', () => {
671671
canonical = ["Power", "a", 12]
672672
`);
673673
//note: 'Multiply' args. are ordered in the output JSON: but the result 'Power'
674-
//BoxedExpression still has (ordered) operands [b, c].
674+
//Expression still has (ordered) operands [b, c].
675675
expect(checkPower('{a^{{b^2}^e}}^{0.5*\\pi}')).toMatchInlineSnapshot(`
676676
box = [
677677
"Power",

test/compute-engine/compile-plugin.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { engine as ce } from '../utils';
22
import { compile } from '../../src/compute-engine/compilation/compile-expression';
33
import type { LanguageTarget, CompileTarget, CompiledOperators, CompiledFunctions, CompilationResult } from '../../src/compute-engine/compilation/types';
4-
import type { BoxedExpression } from '../../src/compute-engine/global-types';
4+
import type { Expression } from '../../src/compute-engine/global-types';
55

66
/**
77
* Example custom target: Python-like compilation
@@ -47,7 +47,7 @@ class PythonTarget implements LanguageTarget {
4747
}
4848

4949
compile(
50-
expr: BoxedExpression,
50+
expr: Expression,
5151
options: any = {}
5252
): CompilationResult {
5353
const { BaseCompiler } = require('../../src/compute-engine/compilation/base-compiler');
@@ -101,7 +101,7 @@ class RPNTarget implements LanguageTarget {
101101
};
102102
}
103103

104-
compile(expr: BoxedExpression, options: any = {}): CompilationResult {
104+
compile(expr: Expression, options: any = {}): CompilationResult {
105105
const { BaseCompiler } = require('../../src/compute-engine/compilation/base-compiler');
106106
const target = this.createTarget();
107107
const rpnCode = BaseCompiler.compile(expr, target);

test/compute-engine/derivatives.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import type { BoxedExpression } from '../../src/compute-engine/global-types';
1+
import type { Expression } from '../../src/compute-engine/global-types';
22
import { engine } from '../utils';
33

4-
function parse(expr: string): BoxedExpression {
4+
function parse(expr: string): Expression {
55
return engine.parse(expr)!;
66
}
77

88
// Helper to create D expressions using MathJSON directly
99
// Note: D(f, x) in LaTeX now parses as Predicate, not the derivative function.
1010
// Use this helper or Leibniz notation (\frac{d}{dx}) for derivatives.
11-
function D(expr: string, ...vars: string[]): BoxedExpression {
11+
function D(expr: string, ...vars: string[]): Expression {
1212
return engine.box(['D', engine.parse(expr), ...vars]);
1313
}
1414

test/compute-engine/extension-contracts.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ import type {
88
CompilationResult,
99
LanguageTarget,
1010
} from '../../src/compute-engine/compilation/types';
11-
import type { BoxedExpression, LibraryDefinition } from '../../src/compute-engine/global-types';
11+
import type { Expression, LibraryDefinition } from '../../src/compute-engine/global-types';
1212

13-
class ContractTarget implements LanguageTarget<BoxedExpression> {
13+
class ContractTarget implements LanguageTarget<Expression> {
1414
getOperators(): CompiledOperators {
1515
return { Add: ['+', 11] };
1616
}
1717

18-
getFunctions(): CompiledFunctions<BoxedExpression> {
18+
getFunctions(): CompiledFunctions<Expression> {
1919
return {};
2020
}
2121

2222
createTarget(
23-
options: Partial<CompileTarget<BoxedExpression>> = {}
24-
): CompileTarget<BoxedExpression> {
23+
options: Partial<CompileTarget<Expression>> = {}
24+
): CompileTarget<Expression> {
2525
const ops = this.getOperators();
2626
const fns = this.getFunctions();
2727
return {
@@ -38,7 +38,7 @@ class ContractTarget implements LanguageTarget<BoxedExpression> {
3838
};
3939
}
4040

41-
compile(expr: BoxedExpression): CompilationResult {
41+
compile(expr: Expression): CompilationResult {
4242
const { BaseCompiler } = require('../../src/compute-engine/compilation/base-compiler');
4343
return {
4444
target: 'contract',
@@ -105,7 +105,7 @@ describe('Extension Contracts', () => {
105105
number: (n: number) => String(n),
106106
preamble: '',
107107
indent: 0,
108-
} as unknown as CompileTarget<BoxedExpression>;
108+
} as unknown as CompileTarget<Expression>;
109109

110110
expect(() => compile(expr, { target: invalidTarget })).toThrow(/"ws\(\)"/);
111111
});
@@ -141,7 +141,7 @@ describe('Extension Contracts', () => {
141141

142142
test('rejects target objects that do not implement LanguageTarget', () => {
143143
const ce = new ComputeEngine();
144-
const invalidTarget = {} as unknown as LanguageTarget<BoxedExpression>;
144+
const invalidTarget = {} as unknown as LanguageTarget<Expression>;
145145

146146
expect(() =>
147147
ce.registerCompilationTarget('broken-target', invalidTarget)
@@ -246,15 +246,15 @@ describe('Extension Contracts', () => {
246246
const rules = ce.rules([
247247
{
248248
match: 'x',
249-
replace: () => 'not-an-expression' as unknown as BoxedExpression,
249+
replace: () => 'not-an-expression' as unknown as Expression,
250250
},
251251
]);
252252

253253
const expr = ce.parse('x');
254254
const rule = rules.rules[0];
255255

256256
expect(() => applyRule(rule, expr, {})).toThrow(
257-
/expected a BoxedExpression or RuleStep/
257+
/expected a Expression or RuleStep/
258258
);
259259
});
260260
});

test/compute-engine/factor.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BoxedExpression, ComputeEngine } from '../../src/compute-engine';
1+
import { Expression, ComputeEngine } from '../../src/compute-engine';
22
import {
33
factorPerfectSquare,
44
factorDifferenceOfSquares,
@@ -8,7 +8,7 @@ import {
88

99
const ce = new ComputeEngine();
1010

11-
function parse(latex: string): BoxedExpression {
11+
function parse(latex: string): Expression {
1212
return ce.parse(latex);
1313
}
1414

test/compute-engine/numbers.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Expression } from '../../src/math-json/types.ts';
2-
import type { BoxedExpression } from '../../src/compute-engine/global-types.ts';
2+
import type { Expression } from '../../src/compute-engine/global-types.ts';
33
import { engine as ce } from '../utils';
44

55
describe('BOXING OF NUMBER', () => {
@@ -50,7 +50,7 @@ describe('BOXING OF NUMBER', () => {
5050
});
5151
});
5252

53-
function checkProps(x: BoxedExpression): string {
53+
function checkProps(x: Expression): string {
5454
const result: string[] = [];
5555
result.push('number literal: ' + x.isNumberLiteral);
5656
result.push('type: ' + x.type.toString());

test/compute-engine/oeis.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describeIfNetwork('OEIS Integration (SUB-12)', () => {
4747
expect(Array.isArray(results)).toBe(true);
4848
});
4949

50-
test('handles BoxedExpression terms', async () => {
50+
test('handles Expression terms', async () => {
5151
const ce = new ComputeEngine();
5252
const terms = [
5353
ce.number(0),

test/compute-engine/patterns.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
import {
2-
BoxedExpression,
2+
Expression,
33
PatternMatchOptions,
44
ExpressionInput,
55
Substitution,
66
} from '../../src/compute-engine';
77
import { _BoxedExpression } from '../../src/compute-engine/boxed-expression/abstract-boxed-expression';
88
import { validatePattern } from '../../src/compute-engine/boxed-expression/boxed-patterns';
9-
import { MathJsonExpression as Expression } from '../../src/math-json/types';
9+
import { MathJsonExpression } from '../../src/math-json/types';
1010
import { engine, latex } from '../utils';
1111

1212
const ce = engine;
1313

1414
function match(
1515
pattern: ExpressionInput,
16-
expr: BoxedExpression | Expression,
16+
expr: Expression | MathJsonExpression,
1717
options?: PatternMatchOptions
1818
): Substitution | null {
1919
// Avoid re-boxing both expr & pattern so as to preserve canonical-status
2020
expr =
21-
expr instanceof _BoxedExpression ? (expr as BoxedExpression) : ce.box(expr);
21+
expr instanceof _BoxedExpression ? (expr as Expression) : ce.box(expr);
2222
pattern =
2323
pattern instanceof _BoxedExpression
24-
? (pattern as BoxedExpression)
24+
? (pattern as Expression)
2525
: ce.box(pattern);
2626

2727
const result = expr.match(pattern, {
@@ -35,7 +35,7 @@ function match(
3535
}
3636

3737
describe('Examples from Patterns and Rules guide', () => {
38-
const pattern: Expression = ['Add', '_', 'x'];
38+
const pattern: MathJsonExpression = ['Add', '_', 'x'];
3939

4040
// console.log("x+42", ce.box(["Add", "x", 42]).match(pattern));
4141
// ➔ { } : the expression matches the pattern by commutativity
@@ -970,7 +970,7 @@ describe('NON EXACT WILDCARDS', () => {
970970
});
971971
});
972972

973-
// GitHub Issue #258: BoxedExpression.match() with a Rational pattern
973+
// GitHub Issue #258: Expression.match() with a Rational pattern
974974
describe('RATIONAL PATTERN MATCHING', () => {
975975
it('should match Rational(3, 2) with Rational pattern', () => {
976976
// Rational with two integers becomes a BoxedNumber

0 commit comments

Comments
 (0)