Grade Up (Monadic) R←⍋Y

Y may be any array of rank greater than 0 but may not contain namespaces. R is an integer vector being the permutation of ⍳1↑⍴Y that places the sub-arrays along the first axis in ascending order. The rules for comparing items of Y with one another are as follows:

Rules for comparing simple scalars

Rules for comparing non-scalar arrays

⎕IO is an implicit argument of Grade Up

Examples

      ⍋22.5 1 15 3 ¯4
5 2 4 3 1
      M
2 3 5
1 4 7
     
2 3 4
5 2 4
     
2 3 5
1 2 6
      ⍋M
2 3 1

Note that character arrays sort differently in the Unicode and Classic Editions.

      M
Goldilocks
porridge   
Porridge   
3 bears   

 

Unicode Edition Classic Edition
      ⍋M
4 1 3 2
      ⍋M
2 4 1 3
      M[⍋M;]
3 bears
Goldilocks
Porridge
porridge  
      M[⍋M;]
porridge
3 bears
Goldilocks
Porridge
      ⍴pb
6 3
      pb
┌────────┬─────┬───┐
│Rivers  │Jason│554│
├────────┼─────┼───┤
│Daintree│John │532│
├────────┼─────┼───┤
│Rivers  │Jason│543│
├────────┼─────┼───┤
│Foad    │Jay  │558│
├────────┼─────┼───┤
│Scholes │John │547│
├────────┼─────┼───┤
│Scholes │John │535│
└────────┴─────┴───┘
      ⍋pb
2 4 3 1 6 5