Grade: Difference between revisions
Content added Content deleted
(Created page with "{{primitive|<x<br>>x}} '''Grade''' returns the domain of a collection (list, table, or dictionary) sorted by its range. It has two versions: '''up''' (<code><...") |
m (Lowercase title) |
||
Line 1: | Line 1: | ||
{{lowercase title}} |
|||
{{primitive|<x<br>>x}} |
{{primitive|<x<br>>x}} |
||
''' |
'''grade''' returns the [[domain]] of a collection (list, table, or dictionary) sorted by its [[range]]. It has two versions: '''up''' (<code><x</code>) and '''down''' (<code>>x</code>), a.k.a. '''asc''' and '''desc''' by analogy with SQL. |
||
Grade uses a [https://en.wikipedia.org/wiki/Category:Stable_sorts stable] sorting algorithm - [[match|equivalent]] items are sorted in their original order. |
Grade uses a [https://en.wikipedia.org/wiki/Category:Stable_sorts stable] sorting algorithm - [[match|equivalent]] items are sorted in their original order. |
Revision as of 20:53, 8 July 2022
Grade
<x
>x
>x
grade returns the domain of a collection (list, table, or dictionary) sorted by its range. It has two versions: up (<x
) and down (>x
), a.k.a. asc and desc by analogy with SQL.
Grade uses a stable sorting algorithm - equivalent items are sorted in their original order.
Sorting (as in sorting the range by itself) can be implemented through the idiom x@<x
or x@>x
. K7 and k9 support an additional dedicated sort-ascending primitive: ^x
.
>34 -1 0 67 32767 4 3 0 2 1 {x(<x)}("xyz";"a";"k";"j";"apl";"bqn") ("apl" "bqn" "xyz" "a" "j" "k")