Skip to content

Bug fixes #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/lambda-calculus.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,13 @@ function parse(code) {
function v(i) {
const r = name(i);
if ( r ) {
const [j,name] = r;
if ( name==="_" )
return [j,new V("()")];
else
return [j,new V(name)];
const [j,termName] = r;
if ( termName==="_" ) {
const undef = new V("()");
undef.defName = name(0)[1];
return [j,undef];
} else
return [j,new V(termName)];
} else
return null;
}
Expand Down Expand Up @@ -372,7 +374,7 @@ function evalLC(term) {
env = new Env(env).setThunk(term.name, new Tuple(lastTerm, lastEnv));
term = term.body;
} else { // Pass the function some other function.
term = lastTerm(awaitArg(term, stack, env));
term = lastTerm(awaitArg(term, [], env));
}
} else if ( term instanceof Tuple ) {
// for primitives
Expand Down