I wonder if exists a way to get top n distinct elements from
a range (infinite too!)
It's impossible to do that for infinite ranges
Why?
sequence!"n*2".myTopDistinct!"a==b"(3);
will give [2,4,6]
I don't quite get it, do you want the least n elements? What
result would you want if the sequence was the following:
sequence!"-n*2".myTopDistinct!"a==b"(3);
The sequence goes like [-2, -4, -6, -8, -10, ...] ad infinitum.
To clarify a doubt, do you mean "top" as in "front", or "top" as
the "greatest" or "least" in terms of comparison? Or maybe "the
first n distinct elements found"? If so, why "sort" in the
original post? It could bring middle elements to front.