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