On 09/16/2011 10:35 PM, Simen Kjaeraas wrote:
On Fri, 16 Sep 2011 22:16:59 +0200, Timon Gehr <[email protected]> wrote:
I suggest:
* Introduce the algorithm "extremum" with a required predicate.
What would that do? The range has more than one extremum if it is
non-constant.
extremum!"a<b"([1,2,3,1,2,3]) would be equal to [1,1].
That is not extremum. It is min.
* Introduce extremumCount and extremumPos, both with required predicate.
And those will be minCount+maxCount and merge(minPos,maxPos) ?
Nope.
extremumCount!"a<b"([1,2,3,1,2,3]) == 2.
There are 4 extrema: [1,3,1,3].
extremumPos!"a>b"([1,2,3,1,2,3]) == [3,1,2,3].
Nope. extremumPos!"a>b"([1,2,3,1,2,3]) == [1,2,3,1,2,3], because 1 is an
extremum.
* Keep minCount and minPos without a predicate. They'd in all likelihood
use extremum.
How?
alias extremumCount!"a<b" minCount;
alias extremumPos!"a<b" minPos;
That won't work because it would also find maxima.
The functions you describe are minCount and minPos.