Exercise: Permutations Index   <<   >>

 
Part A: check that ⍋p is faster than ⍋x

   p ← 1e6?1e6
   x ← ?1e6⍴1e6

   cmpx '⍋p' '⍋x'


Part B: check that ⍒p has not been sped up

   cmpx '⍋p' '⍒p' '⍒x'


Part C: a faster computation for ⍒p

   (⍒p) ≡ ⌽⍋p
   (⍋p) ≡  q ⊣ q[p]←⍳≢q←p
   (⍒p) ≡ ⌽q ⊣ q[p]←⍳≢q←p

   cmpx '⍒p' '⌽q ⊣ q[p]←⍳≢q←p'