On Tue, Jul 27, 2010 at 07:13, Andrei Alexandrescu <
seewebsiteforem...@erdani.org> wrote:

> Tomek Sowiński wrote:
>
>> Andrei Alexandrescu wrote:
>>
>>  median -> r[r.length / 2]
>>>
>>
>> Generalize to quantile.
>> http://en.wikipedia.org/wiki/Quantile
>>
>
> Makes sense.
>
> Andrei
>


Ah, not as methods, but free functions taking sorted ranges:


*  fast merge (on n ranges in one go),
* fast intersection, union, difference, symmetricDifference. But I see these
already exist in std.algo for sets.
* Also, maybe, some kind of takeUpTo(range, Max), that takes all values up
to a certain value Max. As it's ordered, we know there is no more value less
than Max. I don't if there is a mathematical name for that.

It's just a specialized takeWhile!((ElementType!R v) { return
v<Max;})(range);

btw, takeWhile is a _very_ useful function to add to std.algorithm.



Philippe

Reply via email to