Hi Jürgen,
not that I read the reference manual for that particular definition.
Thank you for pointing me to it.
Conclusion: works as designed.
For my idea actually a "*N ⎕CR VAR*" creating output without box
chars would do it.
Best Regards
Hans-Peter
Am 28.02.25 um 17:17 schrieb Dr. Jürgen Sauermann:
Hi Hans-Peter,
I am not sure if your observation below is an error.
The relevant rule in the IBM APL2 language reference manual
is this (Figure 22 on page 138):
/*
For Z←R, where R is a nested array::
...
Z has LN intermediate blank lines between vertically adjacent items C and
D, where:
LN←0⌈¯1+(ρρC)⌈ρρD
*/
Using *8 ⎕CR* and *⍕* for *x* we see:
* 8 ⎕CR x
┌→────────┐
↓┌→─┐ ┌→─┐│
│↓as│ ↓yx││
││df│ │cv││
│└──┘ └──┘│
│ │
│┌→─┐ ┌→─┐│
│↓hj│ ↓ui││
││kl│ │op││
│└──┘ └──┘│
└ϵ────────┘
⍕ x
as yx
df cv
hj ui
kl op *
According to the rule above, LN=1 and consequently one line is
being inserted between the upper two blocks and the lower two blocks.
But now to your *⊂¨x*. The 8 ⎕CR and ⍕ show:
*
8 ⎕CR ⊂¨x
┌→────────────┐
↓┌────┐ ┌────┐│
││┌→─┐│ │┌→─┐││
││↓as││ │↓yx│││
│││df││ ││cv│││
││└──┘│ │└──┘││
│└ϵ───┘ └ϵ───┘│
│┌────┐ ┌────┐│
││┌→─┐│ │┌→─┐││
││↓hj││ │↓ui│││
│││kl││ ││op│││
││└──┘│ │└──┘││
│└ϵ───┘ └ϵ───┘│
└ϵϵ───────────┘
⍕ ⊂¨x
as yx
df cv
hj ui
kl op *
The thing is that enclosing the 4 sub-arrays makes them scalars
which have rank 0. The rule therefore yields LN=0 and consequently
no blank lines are being inserted.
Best Regards,
Jürgen
On 2/17/25 10:46, Hans-Peter Sorge wrote:
Hi,
The output from x is nicely arranged:
/⍝ A 2x2 array of 2x2 arrays/ :
*x←2 2 ⍴(⊂2 2)⍴¨ 'asdf' 'yxcv' 'hjkl' 'uiop'**
x
***as yx
df cv
hj ui
kl op
* ≡x*
2
/⍝ The gaps between arrays: OK.
/*⍕x*
as yx
df cv
hj ui
kl op /
⍝ Correct gaps:/
* ' '=⍕x*
1 0 0 1 1 0 0 1
1 0 0 1 1 0 0 1
1 1 1 1 1 1 1 1
1 0 0 1 1 0 0 1
1 0 0 1 1 0 0 1
Compared to the above output the output from ⊂¨x is distorted,
on larger output it gets confusing as output of "sub arrays" does not
get separated vertically:
/⍝ The shape of each from 2x2 array of scalars of 2x2 arrays :
/* ⍴¨⊂¨x*
/⍝ The output of a 2x2 array of scalars of 2x2 arrays :/
*⊂¨x*
as yx
df cv
hj ui
kl op /
⍝one more ... OK/
*≡⊂¨x*
3
/⍝ Correct vertical gaps are added (one more),
⍝ The horizontal gap gets removed (one less??) instead added:/
*⍕⊂¨x*
as yx
df cv
hj ui
kl op
*' '=⍕⊂¨x*
1 1 0 0 1 1 1 0 0 1 1
1 1 0 0 1 1 1 0 0 1 1
1 1 0 0 1 1 1 0 0 1 1
1 1 0 0 1 1 1 0 0 1 1
Best Regards
Hans-Peter