Help response not quite as expected

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 !

Help response not quite as expected

Postby Phil Last on Tue Nov 21, 2017 11:18 pm

If I click F1 at the indicated point in this line
      t=':':⎕FIX r↓d
              ^
my attention is inadvertently drawn to
https://social.msdn.microsoft.com/Searc ... ?query=FIX
If I insert a redundant blank between the colon and quad
      t=':': ⎕FIX r↓d
              ^
I see the "Fix script" page of Dyalog APL Help which in truth is what I'd rather see.

I've long wished that Dyalog would insert that redundant blank after a colon on grounds of æsthetics alone. Now I have another cause.
User avatar
Phil Last
 
Posts: 445
Joined: Thu Jun 18, 2009 6:29 pm

Re: Help response not quite as expected

Postby JohnS|Dyalog on Wed Nov 22, 2017 10:35 am

I've long wished that Dyalog would insert that redundant blank after a colon on grounds of aesthetics alone. Now I have another cause.

I like Phil's idea. I can't see the change to the result of ⎕CR breaking anyone's code (but I've been wrong before).
User avatar
JohnS|Dyalog
 
Posts: 164
Joined: Wed Sep 10, 2008 10:01 am

Re: Help response not quite as expected

Postby Roger|Dyalog on Wed Nov 22, 2017 4:20 pm

Inserting a blank after the colon won't break my code, but the effect would be less pleasing aesthically, in some cases. When the dfn is one line, blanks have extra aesthetic significance. For example:
      Q←{1≥≢⍵:⍵ ⋄ (∇ ⍵⌿⍨0>s)⍪(⍵⌿⍨0=s)⍪∇ ⍵⌿⍨0<s←⍵ ⍺⍺ ⍵⌷⍨?≢⍵}

For multi-line dfns, I would agree with having a blank after the colon, again on aesthetic grounds.
Roger|Dyalog
 
Posts: 111
Joined: Thu Jul 28, 2011 10:53 am

Re: Help response not quite as expected

Postby JohnS|Dyalog on Wed Nov 22, 2017 5:09 pm

The complete solution would be to preserve all white space in code as typed. However, whenever we have discussed this, we wound up keeping two copies of the code: one source and one tokens. Some of our users tell us that this would represent an unacceptable increase in code size.

An alternative might be to use one additional byte per guard as a count of how many blanks to preserve between the colon and the next token to its right (max 255). Then we could see:

      dice←{
⍵≡6 6: 'Box Cars'
⍵≡1 1: 'Snake Eyes'
=/⍵: 'Pair'
7=+/⍵: 'Seven'
'Unlucky'
}
or
      dice←{
⍵≡6 6: 'Box Cars'
⍵≡1 1: 'Snake Eyes'
=/⍵: 'Pair'
7=+/⍵: 'Seven'
'Unlucky'
}
and
      Q←{1≥≢⍵:⍵ ⋄ (∇ ⍵⌿⍨0>s)⍪(⍵⌿⍨0=s)⍪∇ ⍵⌿⍨0<s←⍵ ⍺⍺ ⍵⌷⍨?≢⍵}
User avatar
JohnS|Dyalog
 
Posts: 164
Joined: Wed Sep 10, 2008 10:01 am


Return to APL Chat

Who is online

Users browsing this forum: No registered users and 1 guest