@@ -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 ← { ⍝ Recursive boxing of nested array.
39
+ box ← { ⎕IO ← 0 ⍝ 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 ← { ⍝ Alignment and centring.
49
+ aligned ← { ⎕IO ← 0 ⍝ 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 ← { ⍝ Gap-separated sub-planes.
57
+ gaps ← { ⎕IO ← 0 ⍝ 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 ← { ⍝ Boxed rank-2 plane.
65
+ plane ← { ⎕IO ← 0 ⍝ 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 ← { ⍝ Join of gap-separated sub-planes.
72
+ join ← { ⎕IO ← 0 ⍝ 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 ← { ⍝ Outer decoration.
78
+ outer ← { ⎕IO ← 0 ⍝ 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 ← { ⍝ Inner subarray decorations.
85
+ inner ← { ⎕IO ← 0 ⍝ 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 ← { ⍝ Border right each subarray.
97
+ right ← { ⎕IO ← 0 ⍝ 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 ← { ⍝ Border below each subarray.
104
+ lower ← { ⎕IO ← 0 ⍝ 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 ← { ⍝ Type decoration char.
110
+ type ← { ⎕IO ← 0 ⍝ Type decoration char.
111
111
dec < | ≡ ⍵ :' ─' ⍝ nested: '─'
112
112
isor ⍵ :' ∇' ⍝ ⎕or: '∇'
113
113
sst ← { ⍝ simple scalar type.
@@ -118,7 +118,7 @@ disp ← { ⎕IO←0 ⍝ Boxed sketch of nested ar
118
118
{(1 = ⍴ ⍵ )⊃ ' +' ⍵ }∪ , sst ¨ dec open ⍵ ⍝ array: mixed or uniform type.
119
119
}
120
120
121
- shape ← { ⍝ Row and column shape decorators.
121
+ shape ← { ⎕IO ← 0 ⍝ Row and column shape decorators.
122
122
dec ≤ 0 = ⍴⍴ ⍵ :⍺ / ¨ ' │─' ⍝ no decoration or scalar.
123
123
cols ← (× ¯1 ↑ ⍴ ⍵ )⊃ ' ⊖→' ⍝ zero or more cols.
124
124
rsig ← (×× / ¯1 ↓ ⍴ ⍵ )⊃ ' ⌽↓' ⍝ zero or more rows.
@@ -146,7 +146,7 @@ display ← { ⎕IO←0 ⍝ Boxed display of array.
146
146
top ← ' ─⊖→' [¯1 ↑ ⍺ ], hrz ⍝ upper border with axis
147
147
bot ← (⊃ ⍺ ), hrz ⍝ lower border with type
148
148
rgt ← ' ┐│' , vrt , ' ┘' ⍝ right side with corners
149
- lax ← ' │⌽↓' [¯1 ↓ 1 ↓ ⍺ ], ¨ ⊂ vrt ⍝ left side(s) with axes,
149
+ lax ← ' │⌽↓' [¯1 ↓ 1 ↓ ⍺ ], ¨ ⊂ vrt ⍝ ⍝ ⍝ left side(s) with axes,
150
150
lft ← ⍉ ' ┌' , (↑ lax ), ' └' ⍝ ... and corners
151
151
lft , (top ⍪ ⍵ ⍪ bot ), rgt ⍝ fully boxed array
152
152
}
@@ -159,7 +159,7 @@ display ← { ⎕IO←0 ⍝ Boxed display of array.
159
159
type ← {{(1 = ⍴ ⍵ )⊃ ' +' ⍵ }∪ , char ¨ ⍵ } ⍝ simple array type
160
160
line ← {(49 = ⎕DT 1 ⍴ ⍵ )⊃ ' -' } ⍝ underline for atom
161
161
162
- { ⍝ recursive boxing of arrays:
162
+ { ⎕IO ← 0 ⍝ recursive boxing of arrays:
163
163
0 = ≡ ⍵ :' ' ⍪ (open ⎕FMT ⍵ )⍪ line ⍵ ⍝ simple scalar
164
164
1 ⍬ ≡ (≡ ⍵ )(⍴ ⍵ ):' ∇' 0 0 box ⎕FMT ⍵ ⍝ object rep: ⎕OR
165
165
1 = ≡ ⍵ :(deco ⍵ )box open ⎕FMT open ⍵ ⍝ simple array
0 commit comments