Skip to content

'expr.transform()' feature commit (from /301)#313

Open
samueltlg wants to merge 2 commits into
cortex-js:mainfrom
samueltlg:expr-transform-extraction
Open

'expr.transform()' feature commit (from /301)#313
samueltlg wants to merge 2 commits into
cortex-js:mainfrom
samueltlg:expr-transform-extraction

Conversation

@samueltlg

@samueltlg samueltlg commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Extracts, with some modern adjustments, the feature commit and a pre/assistive commit from #301.

  • feat: 'assertIsFunction' / 'getOp' utilities
  • Feat: 'Expression.transform()'

(Note that one or two tests (mostly benchmark-related) were failing at the tip-of-main before these changes were made).

(An AI summary):

Baseline failures on clean HEAD:

[arithmetic.test.ts:792](..)
Snapshot drift in EXP cases due to floating-point formatting:
at [arithmetic.test.ts:792](..) and [arithmetic.test.ts:800](..)
Example: N-mach value changed from 3.004166023946433 to 3.0041660239464334.
[calculus.test.ts:1513](..)
Timeout failure in doubly-infinite sum case:
CancellationError: Timeout exceeded (2000ms), thrown from [interruptible.ts:125](..).
Clean-HEAD test summary returned by Jest:

Test Suites: 2 failed, 189 passed, 6 skipped (191/197 run)
Tests: 3 failed, 10491 passed
Snapshots: 2 failed, 3732 passed
Total time: about 497s

In disuse: but set for employment particularly in test-files
'transform()' is a wrapper around 'replace()' - always acting recursively - and offers an ergonomic means to match sub-expression targets and apply common fundamental operations/transformations in an expression 'tree', without the need for custom 'Rule' logic / workarounds.

Change includes tests.

- The typing of 'TransformOptions' has necessitated that 'SimplifyOptions' be shifted from its previous home of 'types-definitions(.ts)', to 'types-kernel-evaluation.ts'. It has also been made generic over Expr/SemiExpr/CE, in a similar way as for its sibling types (such as 'RuleReplaceFunction').
@samueltlg samueltlg changed the title 'expr.transform()' feature commits (from /301) 'expr.transform()' feature commit (from /301) Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant