Philippe Sigaud wrote:


On Tue, Jul 27, 2010 at 07:13, Andrei Alexandrescu <[email protected] <mailto:[email protected]>> 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.

I definitely wanted to add that... in fact I vaguely thought I did! Could you please make a bugzilla entry so it's not forgotten?

Thanks,

Andrei

Reply via email to