@@ -36,7 +36,7 @@ acc ← { ⊃⍺⍺{(⊂⍺ ⍺⍺⊃⍬⍴⍵),⍵}/1↓{⍵,⊂⍬⍴⍵}¯1
36
36
disp ← { ⎕IO ← 0 ⍝ Boxed sketch of nested array.
37
37
⍺ ← ⍬ ⋄ dec ctd ← 2 ↑ ⍺ ⍝ 1:decorated, 1:centred.
38
38
39
- box ← { ⎕IO ← 0 ⍝ Recursive boxing of nested array.
39
+ box ← { ⍝ Recursive boxing of nested array.
40
40
isor ⍵ :⎕FMT ⊂ ⍵ ⍝ ⎕or: '∇name'.
41
41
1 = ≡ , ⍵ :dec open ⎕FMT dec open ⍵ ⍝ simple array: format.
42
42
mat ← matr 1 / dec open ⍵ ⍝ matrix of opened subarrays.
@@ -46,43 +46,43 @@ disp ← { ⎕IO←0 ⍝ Boxed sketch of nested ar
46
46
(≢ ⍴ ⍵ )gaps ⍵ plane subs ⍝ collection into single plane.
47
47
}
48
48
49
- aligned ← { ⎕IO ← 0 ⍝ Alignment and centring.
49
+ aligned ← { ⍝ Alignment and centring.
50
50
rows cols ← sepr ⍴ ¨ ⍵ ⍝ subarray dimensions.
51
51
sizes ← (⌈ / rows )∘ . , ⌈ ⌿ cols ⍝ aligned subarray sizes.
52
52
ctd = 0 :sizes ↑ ¨ ⍵ ⍝ top-left alignment.
53
53
v h ← sepr ⌈ 0.5 × ↑ (⍴ ¨ ⍵ )- sizes ⍝ vertical and horizontal rotation.
54
54
v ⊖ ¨ h ⌽ ¨ sizes ↑ ¨ ⍵ ⍝ centred aligned subarrays.
55
55
}
56
56
57
- gaps ← { ⎕IO ← 0 ⍝ Gap-separated sub-planes.
57
+ gaps ← { ⍝ Gap-separated sub-planes.
58
58
⍺ ≤ 2 :⍵ ⍝ lowish rank: done.
59
59
subs ← (⍺ - 1 )∇ ¨ ⍵ ⍝ sub-hyperplanes.
60
60
width ← ⊃ ⌽ ⍴ ⊃ subs ⍝ width of inter-plane gap.
61
61
fill ← (⍺ width - 3 0 )⍴ ' ' ⍝ inter-plane gap.
62
62
↑ {⍺ ⍪ fill ⍪ ⍵ }/ 1 open subs ⍝ gap-separated planes.
63
63
}
64
64
65
- plane ← { ⎕IO ← 0 ⍝ Boxed rank-2 plane.
65
+ plane ← { ⍝ Boxed rank-2 plane.
66
66
2 < ⍴⍴ ⍺ :⍺ join ⍵ ⍝ gap-separated sub-planes.
67
67
odec ← (dec shape ⍺ )outer ⍵ ⍝ outer type and shape decoration.
68
68
idec ← inner ⍺ ⍝ inner type and shape decorations.
69
69
(odec , idec )collect ⍵ ⍝ collected, formatted subarrays.
70
70
}
71
71
72
- join ← { ⎕IO ← 0 ⍝ Join of gap-separated sub-planes.
72
+ join ← { ⍝ Join of gap-separated sub-planes.
73
73
sep ← (≢ ⍵ )÷ 1 ⌈ ≢ ⍺ ⍝ sub plane separation.
74
74
split ← (0 = sep | ⍳ ≢ ⍵ )⊂ [0 ]⍵ ⍝ separation along first axis.
75
75
(⊂ ⍤ ¯1 ⊢ ⍺ )plane ¨ split ⍝ sub-plane join.
76
76
}
77
77
78
- outer ← { ⎕IO ← 0 ⍝ Outer decoration.
78
+ outer ← { ⍝ Outer decoration.
79
79
sizes ← 1 0 {⊃ ↓ (⍉ ⍣ ⍺ )⍵ }¨ sepr ⍴ ¨ ⍵ ⍝ row and col sizes of subarrays.
80
80
sides ← sizes / ¨¨ ' │─' ⍝ vert and horiz cell sides.
81
81
bords ← dec ↓ ¨ ' ├┬' glue ¨ sides ⍝ joined up outer borders.
82
82
↑ , ¨ / (' ┌' ' ' )⍺ bords ' └┐' ⍝ vertical and horizontal borders.
83
83
}
84
84
85
- inner ← { ⎕IO ← 0 ⍝ Inner subarray decorations.
85
+ inner ← { ⍝ Inner subarray decorations.
86
86
deco ← {(type ⍵ ), 1 shape ⍵ } ⍝ type and shape decorators.
87
87
sepr deco ¨ matr dec open ⍵ ⍝ decorators: tt vv hh .
88
88
}
@@ -94,20 +94,20 @@ disp ← { ⎕IO←0 ⍝ Boxed sketch of nested ar
94
94
lft , top ⍪ ↑ ⍪ ⌿ , / boxes ⍝ completed collection.
95
95
}
96
96
97
- right ← { ⎕IO ← 0 ⍝ Border right each subarray.
97
+ right ← { ⍝ Border right each subarray.
98
98
types ← 2 ⊥ ¨ (⍳ ⍴ ⍵ )= ⊂ ¯1 + ⍴ ⍵ ⍝ right border lower corner types.
99
99
chars ← ' ┼┤┴┘' [types ] ⍝ .. .. .. chars.
100
100
rgt ← {⍵ , (- ≢ ⍵ )↑ (≢ ⍵ )1 1 / ' │' , ⍺ } ⍝ form right border.
101
101
((matr 1 open ⍺ ), ¨ chars )rgt ¨ ⍵ ⍝ cells bordered right.
102
102
}
103
103
104
- lower ← { ⎕IO ← 0 ⍝ Border below each subarray.
104
+ lower ← { ⍝ Border below each subarray.
105
105
split ← {((¯2 + 1 ⊃ ⍴ ⍵ )/ ' ─' )glue ⍺ } ⍝ decorators split with horiz line.
106
106
bot ← {⍵ ⍪ (- 1 ⊃ ⍴ ⍵ )↑ ⍺ split ⍵ } ⍝ lower border.
107
107
(matr ↑ , ¨ / ⍺ )bot ¨ matr ⍵ ⍝ cells bordered below.
108
108
}
109
109
110
- type ← { ⎕IO ← 0 ⍝ Type decoration char.
110
+ type ← { ⍝ Type decoration char.
111
111
dec < | ≡ ⍵ :' ─' ⍝ nested: '─'
112
112
isor ⍵ :' ∇' ⍝ ⎕or: '∇'
113
113
sst ← { ⍝ simple scalar type.
0 commit comments