Apl2ToDoFormattingAlgorithms
This is a sub-page of PhraseBook/ToDo/Apl2Idioms
IA←1+⌊10⍟1⌈NA ⍝ Field width for integral part of number.
IA←+⌿NA≠⌊NA←(10*⍳NS)∘.×NA ⍝ Field width ≤NS of fractional part of number.
IA←+⌿NA≠⌊NA←(10*-1-⍳NS)∘.×NA ⍝ Field width ≤NS of fractional part of number.
CM←1 0⍕10 10⊤⍳NS ⍝ Create col header CM for NS wide text.
⎕FC[3]←'*' ⍝ Fills format overflow with '*'.
⎕FC[4]←'*' ⍝ Fills format overflow with '*'.
CM←⍕⊂1/AA ⍝ From nested to simple char image.
CM←I↓(-I←(-2-2>⍴⍴AA)↑≡AA)↓⍕⊂1/AA ⍝ Nested to simple char image w/o extra blanks.
CM←⍕⊃(C≠' ')⊂¨C←⊂[1]CM ⍝ Columnize rows of data separated by blanks.
CM←⍕⊃(C≠' ')⊂¨C←⊂[2]CM ⍝ Columnize rows of data separated by blanks.
CM←1↓[0]⍕0,[0]AA ⍝ Format and right justify columns of report.
CM←1↓[1]⍕0,[1]AA ⍝ Format and right justify columns of report.
CM←1↓[0](NS,0)⍕0,[0]AA ⍝ Format and right justify NS wide columns.
CM←1↓[1](NS,0)⍕0,[1]AA ⍝ Format and right justify NS wide columns.
M←(⍳↑⍴M),M ⍝ Attach row numbers to a matrix.
,['']VV ⍝ Display vector of vectors vertically.
CM←('^-',B),[0]B,'|',B∘.^B←0 1 ⍝ Truth table: All possibilities of and(^).
CM←('^-',B),[1]B,'|',B∘.^B←0 1 ⍝ Truth table: All possibilities of and(^).
CM←('∨-',B),[0]B,'|',B∘.∨B←0 1 ⍝ Truth table: All possibilities of or(∨).
CM←('∨-',B),[1]B,'|',B∘.∨B←0 1 ⍝ Truth table: All possibilities of or(∨).
CM←('⍲-',B),[0]B,'|',B∘.⍲B←0 1 ⍝ Truth table: All possibilities of nand(⍲).
CM←('⍲-',B),[1]B,'|',B∘.⍲B←0 1 ⍝ Truth table: All possibilities of nand(⍲).
CM←('⍱-',B),[0]B,'|',B∘.⍱B←0 1 ⍝ Truth table: All possibilities of nor(⍱).
CM←('⍱-',B),[1]B,'|',B∘.⍱B←0 1 ⍝ Truth table: All possibilities of nor(⍱).
APL Wiki