Grade up: Difference between revisions

From The K Language Wiki
Content added Content deleted
(add grade up page)
 
("Fix redirects with lowercase titles")
Tag: New redirect
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
#redirect [[grade]]
{{primitive|<x}}
{{lowercase title}}
The '''grade up''' primitive is used to get the indices of an array that would sort it in ascending order.


[[Category:Verbs]]
Since grading is not the same as sorting, a general idiom used to sort arrays is <code>{x(<x)}</code> or other equivalent.
[[Category:Operator verbs]]

[[Category:Primitives]]
For integer arrays:
<pre>
<34 -1 0 67 32767
1 2 0 3 4</pre>

Grading of string arrays largely depends upon the implementation.

For ngn/k(K6), groups by length and sorts each individual group:
<pre>
{x(<x)}("xyz";"a";"k";"j";"apl";"bqn")
("apl"
"bqn"
"xyz"
"a"
"j"
"k")
</pre>

Latest revision as of 06:43, 9 July 2022

Redirect to: