by amluto · 2y ago · 0 comments
Would writing argsort(name_of_array, reverse=True) really be so much worse? Or argsort[reverse] (made up syntax) if you want a point-free function form?
You can read more about it here if you're interested: https://www.aplwiki.com/wiki/Grade
And here's a silly example where a random array is created, then an array lookup is performed on the sorted indexes:
https://kapdemo.dhsdevelopments.com/clientweb2/#a%20%E2%86%9...
https://numpy.org/doc/stable/reference/generated/numpy.argso...
I assume this name derives from argmin and argmax, which go back at least to MATLAB. But MATLAB has sort returning indices too.
Some people prefer terseness, think of this as "advanced next-level Perl one-liners" if that helps ...