Displaying APL fns with explicit axes

APL-related discussions - a stream of APL consciousness.
Not sure where to start a discussion ? Here's the place to be
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !

Displaying APL fns with explicit axes

Postby petermsiegel on Sat May 08, 2021 4:32 pm

This short fn def works just fine, but I was surprised to see the axis displayed without the closing bracket:
      cat0←,[0]     ⍝ In real life, the axis number is dynamically set.
cat0
,[ 0
I couldn't find a reference to the intended display form (though it's hard to search for usefully). I am guessing there's an error in the C display code. Or, is this pedagogical oddity expected?

For reference, here's the environment:
      )clear
clear ws
]version
Dyalog 18.0.39712 64-bit Unicode, BuildID 1db3fcb9
OS Darwin 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
SALT 2.808, Link: 2.0.6
UCMD 2.4
.NET .NET Core 3.1.5
WS 18.0
petermsiegel
 
Posts: 141
Joined: Thu Nov 11, 2010 11:04 pm

Re: Displaying APL fns with explicit axes

Postby Adam|Dyalog on Sun May 09, 2021 5:02 am

Thank you for bringing attention to this.

Note that the default display form of derived functions (and for that sake arrays too) is not intended to (necessarily) be executable. The idea here is that [ has the role of a dyadic operator, with ] only being an auxiliary symbol.

That said, it is easy to see how this display form can be confusing, and so in 18.1 it will include the ] when boxing is on. If you want the default non-boxed display of arrays, you can still obtain an improved display of derived functions with
      ]box on -s=non -t=parens
User avatar
Adam|Dyalog
 
Posts: 134
Joined: Thu Jun 25, 2015 1:13 pm

Re: Displaying APL fns with explicit axes

Postby petermsiegel on Sun May 09, 2021 3:41 pm

Thank you. Depending on the ]box setting, there's an extra space between the derived function ,[ and the dimension 0. It's just a distraction, except perhaps for those learning.
Code: Select all
     a←,[0]
     a
,[ 0
     ]box on -s=mid -tr=parens
Was OFF -style=min -trains=box
     a
,[0
Thanks again.
petermsiegel
 
Posts: 141
Joined: Thu Nov 11, 2010 11:04 pm

Re: Displaying APL fns with explicit axes

Postby Adam|Dyalog on Sun May 09, 2021 4:13 pm

The space will only appear when boxing is completely off. It doesn't appear with boxing on, even when -style=non
User avatar
Adam|Dyalog
 
Posts: 134
Joined: Thu Jun 25, 2015 1:13 pm


Return to APL Chat

Who is online

Users browsing this forum: No registered users and 1 guest