⍝ Grade_up_with_collating_sequence.tc
⍝ ----------------------------------

      ⎕IO←1
      'ABCDE'⍋'BEAD'
3 1 4 2

      ⎕IO←0
      'ABCDE'⍋'BEAD'
2 0 3 1

      ⎕IO←1
      A←5 4ρ'DEADBADECEDEBEADDEED'
      A
DEAD
BADE
CEDE
BEAD
DEED

      'ABCDE'⍋A
2 4 3 1 5

      Q←'FACE$'
      S←'@$&ABCDEF'
      S⍋Q
5 2 3 4 1

      Q[S⍋Q]
$ACEF

      ⎕←K←5 4ρ'dealDealdeadDeadDEED'
deal
Deal
dead
Dead
DEED

      ⎕←H←2 12ρ'abcdefghijklABCDEFGHIJKL'
abcdefghijkl
ABCDEFGHIJKL

      Z←H⍋K
      Z
3 4 1 2 5

      K[Z;]
dead
Dead
deal
Deal
DEED

⍝ DCS ----------------------------------

      DCS←10 2 28⍴' '
      DCS[1;1;1+⍳26]←⎕UCS  64+⍳26
      DCS[1;2;1+⍳26]←⎕UCS 944+⍳26
      DCS[2;2;1+⍳26]←⎕UCS  96+⍳26
      DCS[;1;28]←'0123456789'
      DCS
 ABCDEFGHIJKLMNOPQRSTUVWXYZ0
 αβγδεζηθικλμνξοπρςστυφχψωϊ 

                           1
 abcdefghijklmnopqrstuvwxyz 

                           2
                            

                           3
                            

                           4
                            

                           5
                            

                           6
                            

                           7
                            

                           8
                            

                           9
                            
      DCS⍋'AVENUE'
1 3 6 4 5 2

      H←'LWLOIBY'
      DCS⍋H
6 5 1 3 4 2 7

      H[DCS⍋H]
BILLOWY

      K←5 4ρ'SENT ZAPDOWNALSOBOA '
      K
SENT
 ZAP
DOWN
ALSO
BOA 

      DCS⍋K
2 4 5 3 1

      K[DCS⍋K;]
 ZAP
ALSO
BOA 
DOWN
SENT

      K←5 4ρ'dealDealdeadDeadDEED'
      K
deal
Deal
dead
Dead
DEED

      DCS⍋K
4 3 2 1 5

      K[DCS⍋K;]
Dead
dead
Deal
deal
DEED

      S←⊃'X1' 'X10' 'X2' 'X21' 'X3' 'X9' 'X11' 'x3'
      S
X1 
X10
X2 
X21
X3 
X9 
X11
x3 

      DCS⍋S
1 3 5 6 8 2 7 4

      S[DCS⍋S;]
X1 
X2 
X3 
X9 
x3 
X10
X11
X21

⍝ identical subarrays ----------------------------------

      'ABCDE'⍋'DABBED'
2 3 4 1 6 5

⍝ items not in collating sequence ----------------------------------

      W←'ABCDE'⍋'EXACT'
      W
3 4 1 2 5

      'EXACT'[W]
ACEXT

