Disclose with Axis does not work as with APL2 !?

How to move APL code to Dyalog
Post Reply
Jean-Pierre
Posts: 7
Joined: Wed Feb 15, 2012 10:55 am
Location: Yvelines - France

Disclose with Axis does not work as with APL2 !?

Post by Jean-Pierre »

hello
I noticed this anomaly for some time, I finally decided to share it with you

the definitions of "Disclose with Axis" are :

>>> with Dyalog (Mix with ⎕ML≥2) :
K is an optional axis specification
The value of K must be a fractional number indicating the two axes of Y
between which new axes are to be inserted.

>>> with APL2 : (APL2 Programming : Language Reference pages 96-99)
X defines the axes of Z,into which items of R are structured.
X: Simple scalar or vector, nonnegative integers

Z←2 4⍴'PA' 'MA' 'WE' 'BY' 'IT' 'UP' 'ON' 'HI'
⍴R←(2 4⍴⍳8) (2 4⍴'ABCDEFGH') (Z)
3
⍴¨R
2 4 2 4 2 4

⍴⊃[1 2]R
LENGTH ERROR ======> may be : 2 4 3

but, we have the same result with :
⍴⊃[.5]R
2 4 3

⍴⊃[2 3]R
LENGTH ERROR ======> may be : 3 2 4

same result with :
⍴⊃[1.5]R
3 2 4

⍴⊃[1 3]R ======> may be : 2 3 4 ====> not possible with Dyalog ?

in the the same way, the order of the axes can not be changed as shown on page 98

is that this difference in operation is voluntary on your part?
it is noticeable it might be possible to coexist both modes, since we have:
Dyalog : ".... a fractional number ...."
APL2 : "....... integers"

is that this improvement is possible ?
JohnS|Dyalog

Re: Disclose with Axis does not work as with APL2 !?

Post by JohnS|Dyalog »

Hi Jean-Pierre,
Thanks for pointing this out; it does look strange.
We will investigate.
John.
Jay|Dyalog

Re: Disclose with Axis does not work as with APL2 !?

Post by Jay|Dyalog »

Hi Jean-Pierre,

Thank you for this suggestion. I have now implemented the full APL2 behaviour of disclose-with-axis, and it will be available in Dyalog APL Version 14.0 (scheduled for release in 2014).

This is how your examples work in a Dyalog V14 session with ⎕ML≥2:

Code: Select all

      Z←2 4⍴'PA' 'MA' 'WE' 'BY' 'IT' 'UP' 'ON' 'HI'
      ⍴R←(2 4⍴⍳8) (2 4⍴'ABCDEFGH') (Z)
3
      ⍴¨R
 2 4  2 4  2 4
      ⍴⊃[1 2]R
2 4 3
      ⍴⊃[2 3]R
3 2 4
      ⍴⊃[1 3]R
2 3 4

Regards,
Jay.
Post Reply