Function
mSeq
(
pats: Pat[],
exprs: ReadonlyArray<Expression>,
x: Expression,
env: Env,
k: () => boolean
)
Source from the content-addressed store, hash-verified
| 163 | } |
| 164 | |
| 165 | // Power(base, m_.) vs a non-Power expression matches base with m → 1; |
| 166 | // Add/Multiply nodes with exactly one non-optional operand match a |
| 167 | // non-matching expression by defaulting the optionals. |
| 168 | function mCollapse( |
| 169 | pat: { op: string; ops: Pat[]; ac: boolean }, |
| 170 | expr: Expression, |
| 171 | x: Expression, |
| 172 | env: Env, |
| 173 | k: () => boolean |
| 174 | ): boolean { |
| 175 | const optionals = pat.ops.filter((p) => p.kind === 'optslot'); |
| 176 | const others = pat.ops.filter((p) => p.kind !== 'optslot'); |
| 177 | // collapsing is only justified when at least one optional defaults away; |
| 178 | // a node with no optionals must match its operator structurally |
| 179 | if ( |
Tested by
no test coverage detected