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

Function cond

src/compute-engine/boxed-expression/match.ts:609–621  ·  view source on GitHub ↗
(xs: ReadonlyArray<Expression> /* , generated: Set<string> */)

Source from the content-addressed store, hash-verified

607
608 // -a -> 0-a
609 if (isFunction(expr, 'Negate') && headAdmits(operator, expr))
610 result = matchVariation('Subtract', [0, expr.op1]);
611
612 if (result !== null) return result;
613 }
614
615 // The pattern is ['Multiply', a, b]
616 if (operator === 'Multiply') {
617 // x -> 1*x
618 let result = matchVariation('Multiply', [1, expr]);
619 if (result !== null) return result;
620
621 // -x -> -1*x
622 if (isFunction(expr, 'Negate') && headAdmits(operator, expr)) {
623 result = matchVariation('Multiply', [-1, expr.op1]);
624 if (result !== null) return result;

Callers

nothing calls this directly

Calls 2

isWildcardFunction · 0.90
wildcardTypeFunction · 0.90

Tested by

no test coverage detected