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

Function matchAll

src/compute-engine/rubi/match.ts:69–89  ·  view source on GitHub ↗
(
  pat: Pat,
  expr: Expression,
  x: Expression,
  cap = 8,
  deadline?: number
)

Source from the content-addressed store, hash-verified

67 * assignment, the next assignment must be tried — e.g.
68 * `(a+bx)^m (c+dx)^n` factor roles are interchangeable and conditions
69 * often hold for only one orientation.
70 */
71export function matchAll(
72 pat: Pat,
73 expr: Expression,
74 x: Expression,
75 cap = 8,
76 deadline?: number
77): Env[] {
78 const envs: Env[] = [];
79 const env: Env = new Map();
80 const saved = _matchDeadline;
81 _matchDeadline = deadline;
82 try {
83 m(pat, expr, x, env, () => {
84 envs.push(new Map(env));
85 return envs.length >= cap; // false ⇒ keep backtracking for more
86 });
87 } finally {
88 _matchDeadline = saved;
89 }
90 return envs;
91}
92

Callers 2

rubi-match.test.tsFile · 0.90
dispatchMethod · 0.90

Calls 1

mFunction · 0.70

Tested by

no test coverage detected