Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
qpz
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed Jan 4, 2024
1 parent a6d297f commit bf51778
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions base/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
.gradle
src/main/gen
src/main/resources/META-INF/native-image
5 changes: 4 additions & 1 deletion base/src/main/java/org/aya/base/core/AppTerm.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

public record AppTerm(@NotNull Term fun, @NotNull Term arg) implements Term {
@Override public @NotNull Term bindAt(@NotNull LocalVar var, int depth) {
return new AppTerm(fun.bindAt(var, depth), arg.bindAt(var, depth));
var newFun = fun.bindAt(var, depth);
var newArg = arg.bindAt(var, depth);
if (newFun == fun && newArg == arg) return this;
return new AppTerm(newFun, newArg);
}
}
4 changes: 3 additions & 1 deletion base/src/main/java/org/aya/base/core/LamTerm.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

public record LamTerm(Term body) implements Term {
@Override public @NotNull Term bindAt(@NotNull LocalVar var, int depth) {
return new LamTerm(body.bindAt(var, depth + 1));
var newBody = body.bindAt(var, depth + 1);
if (newBody == body) return this;
return new LamTerm(newBody);
}
}

0 comments on commit bf51778

Please sign in to comment.