how to get top N distinct elements from range?
bearophile
bearophileHUGS at lycos.com
Fri Mar 8 15:41:12 PST 2013
Andrea Fontana:
> But i think "front" was "cached", but it seems not...
The caching of map front was recently removed.
More test code:
import std.stdio, std.range, std.algorithm, std.traits,
std.random;
void main() {
5.iota.map!((_) {
auto x = uniform(0, 10);
write("*");
return x;
}).filter!(_ => true).array;
}
Prints:
**********
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list