MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / matchNonCanonical

Function matchNonCanonical

test/compute-engine/patterns.test.ts:1171–1179  ·  view source on GitHub ↗
(
    pattern: Expression,
    expr: Expression,
    options?: PatternMatchOptions
  )

Source from the content-addressed store, hash-verified

1169describe('matchPermutations option', () => {
1170 // Helper to match with non-canonical expressions to test permutation behavior
1171 const matchNonCanonical = (
1172 pattern: Expression,
1173 expr: Expression,
1174 options?: PatternMatchOptions
1175 ) => {
1176 const boxedPattern = ce.expr(pattern, { form: 'raw' });
1177 const boxedExpr = ce.expr(expr, { form: 'raw' });
1178 return boxedExpr.match(boxedPattern, { useVariations: true, ...options });
1179 };
1180
1181 test('default behavior tries permutations for commutative operators', () => {
1182 // Add is commutative, so pattern [Add, 1, _a] should match [Add, x, 1]

Callers 1

patterns.test.tsFile · 0.85

Calls 2

exprMethod · 0.65
matchMethod · 0.65

Tested by

no test coverage detected