pmat←{⎕ML←1             ⍝ Permutation matrix of ⍳⍵.
    {                   ⍝ perms of ⍳⍵:
        1≥⍴⍵:↑,↓⍵       ⍝ short vector: done.
        ↑⍪/⍵,∘∇¨⍵∘~¨⍵   ⍝ items prefix sub-perms of remainder.
    }⍳⍵                 ⍝ permutations of identity perm.
}

code_colours

test script

Back to: notes

Back to: Workspaces