This commit is contained in:
2024-12-01 16:08:41 -05:00
parent 0df296a22d
commit 1c0ea769bb
2 changed files with 123 additions and 19 deletions

View File

@@ -174,8 +174,6 @@ interface ILo<A> {
// Find the largest from the evaluator.
A argmax(IEvaluator<A> eval);
A argmaxHelper(IEvaluator<A> eval, A prev, Integer prevVal);
// Skip this element of the list.
ILo<A> skip();
// Sort the list with the comparator.
ILo<A> sort(IComparator<A> comp);
ILo<A> sortHelper(IComparator<A> comp, ILo<A> sorted);
@@ -207,11 +205,7 @@ class Cons<A> implements ILo<A> {
return prevVal >= nowVal
? this.rest.argmaxHelper(eval, prev, prevVal)
: this.rest.skip().argmaxHelper(eval, now, nowVal);
}
public ILo<A> skip() {
return this.rest;
: this.rest.argmaxHelper(eval, now, nowVal);
}
public ILo<A> sort(IComparator<A> comp) {
@@ -246,10 +240,6 @@ class Mt<A> implements ILo<A> {
return prev;
}
public ILo<A> skip() {
return this;
}
public ILo<A> sort(IComparator<A> comp) {
return this;
}