summaryrefslogtreecommitdiff
path: root/src/interpreter/interpreter.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth@simponic.xyz>2025-03-02 16:32:01 -0700
committerElizabeth Hunt <elizabeth@simponic.xyz>2025-03-02 16:32:01 -0700
commitd8511f4ad3bc3a326de7f7af2fb8703d5f471e36 (patch)
treeaaf7a91a60eb7436f0d00883cd54ecb90d703d8e /src/interpreter/interpreter.ts
parent16eb0ad4d5d8b2ba915eae5190e6b0cfe8a1573c (diff)
downloadthe-abstraction-engine-d8511f4ad3bc3a326de7f7af2fb8703d5f471e36.tar.gz
the-abstraction-engine-d8511f4ad3bc3a326de7f7af2fb8703d5f471e36.zip
run prettier
Diffstat (limited to 'src/interpreter/interpreter.ts')
-rw-r--r--src/interpreter/interpreter.ts20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/interpreter/interpreter.ts b/src/interpreter/interpreter.ts
index 65a848f..c79a2cf 100644
--- a/src/interpreter/interpreter.ts
+++ b/src/interpreter/interpreter.ts
@@ -34,7 +34,7 @@ export type DebrujinifiedLambdaTerm =
export const debrujinify = (
term: LambdaTerm,
- symbolTable: SymbolTable
+ symbolTable: SymbolTable,
): DebrujinifiedLambdaTerm => {
if (isVariable(term)) {
if (!symbolTable.has(term)) {
@@ -67,14 +67,14 @@ export const debrujinify = (
}
throw new InvalidLambdaTermError(
- `Invalid lambda term: ${JSON.stringify(term)}`
+ `Invalid lambda term: ${JSON.stringify(term)}`,
);
};
export const substitute = (
inTerm: DebrujinifiedLambdaTerm,
index: number,
- withTerm: DebrujinifiedLambdaTerm
+ withTerm: DebrujinifiedLambdaTerm,
): DebrujinifiedLambdaTerm => {
if ("index" in inTerm) {
if (inTerm.index > index) {
@@ -110,13 +110,13 @@ export const substitute = (
}
throw new InvalidLambdaTermError(
- `Invalid lambda term: ${JSON.stringify(inTerm)}`
+ `Invalid lambda term: ${JSON.stringify(inTerm)}`,
);
};
export const adjustIndices = (
term: DebrujinifiedLambdaTerm,
- delta: number
+ delta: number,
): DebrujinifiedLambdaTerm => {
if ("index" in term) {
return {
@@ -148,7 +148,7 @@ export const adjustIndices = (
}
throw new InvalidLambdaTermError(
- `Invalid lambda term: ${JSON.stringify(term)}`
+ `Invalid lambda term: ${JSON.stringify(term)}`,
);
};
@@ -177,7 +177,7 @@ export const betaReduce = (
if ("application" in term) {
const { left } = term.application;
const args = term.application.args.map((term) =>
- betaReduce(term, maxDepth - 1)
+ betaReduce(term, maxDepth - 1),
);
return args.reduce((acc: DebrujinifiedLambdaTerm, x) => {
@@ -202,7 +202,7 @@ export const betaReduce = (
}
throw new InvalidLambdaTermError(
- `Invalid lambda term: ${JSON.stringify(term)}`
+ `Invalid lambda term: ${JSON.stringify(term)}`,
);
};
@@ -222,7 +222,7 @@ export const emitDebrujin = (term: DebrujinifiedLambdaTerm): string => {
}
throw new InvalidLambdaTermError(
- `Invalid lambda term: ${JSON.stringify(term)}`
+ `Invalid lambda term: ${JSON.stringify(term)}`,
);
};
@@ -233,7 +233,7 @@ export const emitNamed = (term: DebrujinifiedLambdaTerm): string => {
if ("abstraction" in term) {
return `(λ (${term.abstraction.param}) . ${emitNamed(
- term.abstraction.body
+ term.abstraction.body,
)})`;
}