Skip to content

Commit

Permalink
Merge pull request #101 from JohanWiltink/main
Browse files Browse the repository at this point in the history
fix `free` calls in `L` and `wrap`
  • Loading branch information
JohanWiltink authored Jan 29, 2024
2 parents 9033667 + f3fefd1 commit 0c44a2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lambda-calculus.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class L {
this.body = body;
}
free() {
const r = this.body.free();
const r = this.body.free?.() || new Set ;
r.delete(this.name);
return r;
}
Expand Down Expand Up @@ -169,7 +169,7 @@ export function toInt(term) {
function parse(code) {
function parseTerm(env,code) {
function wrap(name,term) {
const FV = term.free(); FV.delete("()");
const FV = term.free?.() || new Set ; FV.delete("()");
if ( config.purity === "Let" )
return Array.from(FV).reduce( (tm,nm) => {
if ( env.has(nm) ) {
Expand Down

0 comments on commit 0c44a2a

Please sign in to comment.