Re:Array Languages vs. the Curse of the Spreadsheet
by shrubble on Tuesday March 05, 2024 @06:38PM
(#39610494)
That symbol is easy to remember, it is Grade Up and when pointing the other way it is Grade Down -and yes I did remember that from sight and did not have to look it up. See https://aplwiki.com/wiki/Grade-Up
[ Parent
| on HN ]
Re:Array Languages vs. the Curse of the Spreadsheet
by amluto on Tuesday March 05, 2024 @07:50PM
(#39610964)
Now I know what that particular symbol means! Except that it looks kind of like a down arrow, and that link suggests it’s Grade Down.
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?
Re:Array Languages vs. the Curse of the Spreadsheet
by shrubble on Wednesday March 06, 2024 @01:16AM
(#39612861)
You are correct, it is "Grade Down".
Some people prefer terseness, think of this as "advanced next-level Perl one-liners" if that helps ...
Re:Array Languages vs. the Curse of the Spreadsheet
by lokedhs on Wednesday March 06, 2024 @06:48AM
(#39614902)
It's not sort. In Kap, sort down is ∨. The grade functions returns a sorted index. Basically ⍒ 3 1 2 1 1 returns 0 2 1 3 4. So yes, it performs a sort, but it returns an index that can be used to later look up the respective elements.
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...
Re:Array Languages vs. the Curse of the Spreadsheet
by amluto on Wednesday March 06, 2024 @10:23AM
(#39616910)
That’s why I said argsort :)
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.