Skip to content

Commit 0c44a2a

Browse files
authored
Merge pull request #101 from JohanWiltink/main
fix `free` calls in `L` and `wrap`
2 parents 9033667 + f3fefd1 commit 0c44a2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lambda-calculus.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class L {
4242
this.body = body;
4343
}
4444
free() {
45-
const r = this.body.free();
45+
const r = this.body.free?.() || new Set ;
4646
r.delete(this.name);
4747
return r;
4848
}
@@ -169,7 +169,7 @@ export function toInt(term) {
169169
function parse(code) {
170170
function parseTerm(env,code) {
171171
function wrap(name,term) {
172-
const FV = term.free(); FV.delete("()");
172+
const FV = term.free?.() || new Set ; FV.delete("()");
173173
if ( config.purity === "Let" )
174174
return Array.from(FV).reduce( (tm,nm) => {
175175
if ( env.has(nm) ) {

0 commit comments

Comments
 (0)