Grade up: Difference between revisions
Content added Content deleted
(add stable sort desc) |
mNo edit summary |
||
Line 13: | Line 13: | ||
Grading of string arrays largely depends upon the implementation. |
Grading of string arrays largely depends upon the implementation. |
||
For ngn/k(K6), groups by |
For ngn/k(K6), groups by type and sorts each individual group: |
||
<pre> |
<pre> |
||
{x(<x)}("xyz";"a";"k";"j";"apl";"bqn") |
{x(<x)}("xyz";"a";"k";"j";"apl";"bqn") |
Revision as of 08:49, 11 July 2021
Grade up
<x
The grade up primitive is used to get the indices of an array that would sort it in ascending order.
Since grading is not the same as sorting, a general idiom used to sort arrays is {x(<x)}
or other equivalent.
Grade primitives generally use a stable sort, which means that an ascending grade may not always be the inverse of a descending grade.
For numeric arrays:
<34 -1 0 67 32767 1 2 0 3 4
Grading of string arrays largely depends upon the implementation.
For ngn/k(K6), groups by type and sorts each individual group:
{x(<x)}("xyz";"a";"k";"j";"apl";"bqn") ("apl" "bqn" "xyz" "a" "j" "k")