3 ms·
Just curious re: the findWith() example, how would you find the last number in a list that is greater than the min while still being lazy?
by dluan 11y ago
Just curious re: the findWith() example, how would you find the last number in a list that is greater than the min while still being lazy?
- throwanem 11y agoYou wouldn't, because you can't be sure you've found the last value satisfying the predicate until you reach the end of the list. To do it lazily, you'd have to reverse the list first, but that's O(n), so not practical with very long lists.