dxb←{                                           ⍝ Drop eXtraneous Blanks.
    ⍺←' ' ⋄ 1<|≡⍵:(⊂⍺)∇¨⍵                       ⍝ nested?
    2<⍴⍴⍵:(¯1↓⍴⍵){(⍺,1↓⍴⍵)⍴⍵}⍺ ∇,[¯1↓⍳⍴⍴⍵]⍵     ⍝ array
    b←⍵∊⍺                                       ⍝ mask
    1≥⍴⍴⍵:(1↑b)(b⍲1↓b,1)/⍵                     ⍝ vector
    b←∧⌿b(0,1↑b)(b⍲1↓b,1)/⍵                 ⍝ matrix
}

code_colours

test script

Back to: notes

Back to: Workspaces