⍋ — Grade up / Grade up by

Function. Keys: Alt-Backslash 7. Ranks: ∞ monadic, ∞ ∞ dyadic

⍋Y gives indices that sort major cells ascending. Stable; uses structural ordering, without tolerance. NaN sorts after every other number.

⍋30 10 20          ⍝ [1 2 0]ₓ
v←30 10 20 ⋄ [⍋v]⌷v ⍝ 10 20 30
⍋2 1 2 1           ⍝ [1 3 0 2]ₓ

C⍋Y uses a character collation array C.

"cba"⍋"abc"        ⍝ [2 1 0]ₓ

See ⍒, and < to sort.

Inverse

⍋⁻¹P gives an array whose grade is the permutation P. Any other P is a DOMAIN error.

⍋⁻¹2 0 1   ⍝ [1 2 0]ₓ