Skip to content

Commit d33527a

Browse files
committed
let -> const
1 parent a50431f commit d33527a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/lambda-calculus.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const config = { verbosity: "Calm" // Calm | Concise | Loquacious | Verbos
2323
};
2424

2525
function union(left, right) {
26-
let r = new Set(left);
26+
const r = new Set(left);
2727
for ( const name of right ) r.add(name);
2828
return r;
2929
}
@@ -40,7 +40,7 @@ class L {
4040
this.body = body;
4141
}
4242
free() {
43-
let r = this.body.free();
43+
const r = this.body.free();
4444
r.delete(this.name);
4545
return r;
4646
}
@@ -71,7 +71,7 @@ class Env extends Map {
7171
setThunk(i,val) {
7272
this.set(i, function*() {
7373
// console.warn(`expensively calculating ${ i }`);
74-
let result = (yield val) ?? val; // If val is not A or V, then it need not be evaluated
74+
const result = (yield val) ?? val; // If val is not A or V, then it need not be evaluated
7575
while ( true ) yield result;
7676
} () );
7777
return this;
@@ -352,7 +352,7 @@ function evalLC(term) {
352352
if ( term.name==="()" )
353353
{ console.error(`eval: evaluating undefined inside definition of "${term.defName}"`); throw new EvalError; } // depend on verbosity here
354354
else {
355-
let res = env.getValue(term.name);
355+
const res = env.getValue(term.name);
356356
if ( ! res.env )
357357
term = res;
358358
else {
@@ -366,7 +366,7 @@ function evalLC(term) {
366366
stack.push([ new Tuple(term.right, new Env(env)), true ]);
367367
term = term.left;
368368
} else if ( term instanceof L ) {
369-
let [ { term: lastTerm, env: lastEnv }, isRight, isEvaluated ] = stack.pop();
369+
const [ { term: lastTerm, env: lastEnv }, isRight, isEvaluated ] = stack.pop();
370370
if ( isEvaluated ) {
371371
// A non-evaluated term was received from an Env, but it is now evaluated.
372372
// Store it.
@@ -383,7 +383,7 @@ function evalLC(term) {
383383
({term, env} = term);
384384
} else { // Not a term
385385
if ( stack.length === 0 ) return term;
386-
let [ { term: lastTerm, env: lastEnv }, isRight, isEvaluated ] = stack.pop();
386+
const [ { term: lastTerm, env: lastEnv }, isRight, isEvaluated ] = stack.pop();
387387
if ( isEvaluated ) {
388388
// A non-evaluated term was received from an Env, but it is now evaluated.
389389
// Store it.
@@ -393,7 +393,7 @@ function evalLC(term) {
393393
term = lastTerm;
394394
env = lastEnv;
395395
} else { // lastTerm is a JS function
396-
let res = lastTerm(term);
396+
const res = lastTerm(term);
397397
if ( res.term ) {
398398
({term, env} = res);
399399
if ( ! env ) env = new Env;

0 commit comments

Comments
 (0)