Let $S$ be a set of numbers in $\mathbb N$.
Let us define two functions:
i) SumLessThan10
that returns 1, if the sum of the elements of $S$ is 9 or fewer and 0, if the sum is greater than 10.
ii) Mean
that calculates the arthimetic mean of $S$.
Let us assume we have some iteration for calculating the sum and the mean (is there another way of doing it?), then for
i) SumLessThan10
, as soon as the sum reaches 10 (if it does), we can finish the calculation; we don't need to necessarily iterate through the whole set of $S$.
ii) In order to calculate the mean, we must iterate through the whole set of $S$, we cannot use 'lazy-evaluation'.
Is there a name for functions that can (always/ sometimes) be lazily-evaluated in this way, to distinguish them from functions that must be run over all elements in a set in order to get the result?