packN←{                     ⍝ Null packing.

    cmp←{
        mask←,⍵≠1↑0⍴⍵       ⍝ mask of non-nulls.
        (⍴⍵)mask(mask/,⍵)   ⍝ shape mask non-nulls.
    }

    exp←{
        shape mask items←⍵
        shapemask\items
    }

    ⍺←1 ⋄ ⍺:cmp ⍵ ⋄ exp ⍵   ⍝ compress or expand.
}
code_colours

test script

Back to: notes

Back to: Workspaces