You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
select is a very overloaded term, with common meanings in databases (inspired from SQL) and Unix I/O APIs. The fact that Base defined a function with that name is annoying for query packages: both Query.jl and DataFramesMeta.jl define a @select macro, and the latter currently defines a select function (with type piracy issues, cf. JuliaData/DataFramesMeta.jl#75).
On top of this, select does not appear to be a standard name at all for what this function does, i.e. partial sorting a.k.a. selection algorithm. Very few languages seem to provide such a function in their standard library, and none uses this name. The closest example I could find is the C++ stdlib, which provides partial_sort and nth_element (the latter being equivalent to our select when passed a single index). Perl's Sort::Key::Top module provides topsort and atpos, respectively. Python provides heapq.nlargest/heapq.nsmallest, but no equivalent of nth_element/atpos. C++, MATLAB, Ruby, Rust and Go do not support this AFAICT.
I suggest renaming select to partial_sort or partialsort. It appears to be the most common name used on forums (in particular since the C++ stdlib is the only major implementation around), it's similar to sort, it's more explicit and thus easier to find and it does not conflict with other uses.
For reference, select was added in 51d055d and integrated to Base in 561bcc3.
The text was updated successfully, but these errors were encountered:
select
is a very overloaded term, with common meanings in databases (inspired from SQL) and Unix I/O APIs. The fact that Base defined a function with that name is annoying for query packages: both Query.jl and DataFramesMeta.jl define a@select
macro, and the latter currently defines aselect
function (with type piracy issues, cf. JuliaData/DataFramesMeta.jl#75).On top of this,
select
does not appear to be a standard name at all for what this function does, i.e. partial sorting a.k.a. selection algorithm. Very few languages seem to provide such a function in their standard library, and none uses this name. The closest example I could find is the C++ stdlib, which providespartial_sort
andnth_element
(the latter being equivalent to ourselect
when passed a single index). Perl'sSort::Key::Top
module providestopsort
andatpos
, respectively. Python providesheapq.nlargest
/heapq.nsmallest
, but no equivalent ofnth_element
/atpos
. C++, MATLAB, Ruby, Rust and Go do not support this AFAICT.I suggest renaming
select
topartial_sort
orpartialsort
. It appears to be the most common name used on forums (in particular since the C++ stdlib is the only major implementation around), it's similar tosort
, it's more explicit and thus easier to find and it does not conflict with other uses.For reference,
select
was added in 51d055d and integrated to Base in 561bcc3.The text was updated successfully, but these errors were encountered: