A (not efficient) way to to this is range.array.sort.uniq.take(n) but it's a bit overkill, it sorts elements, and of course doesn't work with infinite ranges. Am i missing any function?
I wonder if exists a way to get top n distinct elements from a
range (infinite too!)
- how to get top N distinct elements from range? Andrea Fontana
- Re: how to get top N distinct elements from range? Ary Borenszweig
- Re: how to get top N distinct elements from range? bearophile
- Re: how to get top N distinct elements from range... Andrea Fontana
- Re: how to get top N distinct elements from range? jerro
- Re: how to get top N distinct elements from range... Andrea Fontana
- Re: how to get top N distinct elements from r... Ivan Kazmenko
- Re: how to get top N distinct elements fr... Andrea Fontana
- Re: how to get top N distinct elemen... bearophile
- Re: how to get top N distinct el... bearophile
- Re: how to get top N distinc... Chris Cain