CLEAN limit impl
This commit is contained in:
parent
852f48d522
commit
b9ae7cfff2
@ -60,19 +60,10 @@ public class InfiniteList<T> {
|
||||
return InfiniteList.end();
|
||||
}
|
||||
|
||||
/*
|
||||
* next tail ->
|
||||
* get the current tail
|
||||
* check if actually.err(). If actually.err() then return limit(n). If ok()
|
||||
* return limit - 1
|
||||
*/
|
||||
|
||||
Memo<InfiniteList<T>> tail = Memo.from(() -> {
|
||||
if (this.head.get().unless(null) == null) {
|
||||
return this.tail.get().limit(n);
|
||||
}
|
||||
return this.tail.get().limit(n - 1);
|
||||
});
|
||||
Memo<InfiniteList<T>> tail = Memo.from(
|
||||
() -> this.head.get()
|
||||
.transform(h -> this.tail.get().limit(n - 1))
|
||||
.except(() -> this.tail.get().limit(n)));
|
||||
return new InfiniteList<>(this.head, tail);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user