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

Function createEngine

scripts/fungrim/load.ts:133–153  ·  view source on GitHub ↗
(
  declarations: Declarations,
  options?: { compat?: boolean }
)

Source from the content-addressed store, hash-verified

131 * require `set` operands (every Fungrim domain is mathematically a set).
132 * Rewrite `collection` -> `set` in shell signatures. (`set` is a subtype of
133 * `collection`, so Element/indexing-set usages keep working.)
134 */
135function setify(signature: string): string {
136 return signature.replace(/\bcollection\b/g, 'set');
137}
138
139/**
140 * Names from the declarations table that are NOT engine built-ins — the
141 * true shells. The table is generated when the translator runs; heads
142 * promoted to engine built-ins since then (e.g. the Tier-2 special-function
143 * kernels: EllipticK/E, AGM, Hypergeometric2F1/1F1, JacobiTheta,
144 * DedekindEta) must not be re-declared, or the signature-only shell would
145 * shadow the built-in and hide its numeric evaluator.
146 */
147export function shellOnlyNames(declarations: Declarations): Set<string> {
148 const probe = new ComputeEngine();
149 const out = new Set<string>();
150 for (const name of Object.keys(declarations.declarations))
151 if (probe.lookupDefinition(name) === undefined) out.add(name);
152 return out;
153}
154
155/**
156 * Create a ComputeEngine with every shell declared in a dedicated child

Callers 4

generateReferenceDocFunction · 0.90
mainFunction · 0.90
runStage2Function · 0.90
runStage1Function · 0.90

Calls 6

pushScopeMethod · 0.95
declareMethod · 0.95
shellOnlyNamesFunction · 0.85
setifyFunction · 0.70
entriesMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected