Fortuitous inverse

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 !

Fortuitous inverse

Postby Phil Last on Tue Apr 25, 2017 6:33 pm

I always keep an if operator in the ws:
      if←{
1∊⍵⍵⊣⍵:⍺⍺⊣⍵
    ⍵
}
This allows me to do, among an awful lot of other stuff:
      ⊂if≡
which I understand is going to be an i-beam in 16 as "enclose if simple".
What's not immediately obvious is that
      ⊃if≢
is in many cases its direct inverse "disclose if single".
Sometimes APL is just right even without meaning to be!
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: Fortuitous inverse

Postby Michael|Dyalog on Wed Apr 26, 2017 7:24 am

Hi Phil,
a minor detail: it's not going to be i-beam, it will have its own symbol!
Michael|Dyalog
 
Posts: 23
Joined: Thu Mar 02, 2017 4:29 pm

Re: Fortuitous inverse

Postby JohnS|Dyalog on Wed Apr 26, 2017 8:49 am

If - nice!
"Nest" (formerly known as enclose-if-simple) will be monadic ⊆.
Dyadic ⊆ will be APL2(⎕ML=3)-style "partition". We're hoping this will encourage people towards writing their code in migration-level 1.
JohnS|Dyalog
 

Re: Fortuitous inverse

Postby paulmansour on Tue May 02, 2017 1:25 pm

Dyadic ⊆ will be APL2(⎕ML=3)-style "partition". We're hoping this will encourage people towards writing their code in migration-level 1.


I've been meaning to do this for a while, and that will certainly help. I feel somewhat duped by Dyalog ... I had always thought that one should be using the highest migration level...

Anyway, I want to change a large code base from ML 3 to ML 1. Can this be done programatically or is it a painful line-by-line inspection? I haven't thought that much about it yet...
paulmansour
 
Posts: 420
Joined: Fri Oct 03, 2008 4:14 pm

Re: Fortuitous inverse

Postby Phil Last on Tue May 02, 2017 7:59 pm

If up-arrow were only either mix or first, right-shoe were only first or mix and if equal-underbar were only depth then yes, you could write a function to do it.

If you could find a sure way to distinguish a monadic from a dyadic call to the functions represented by those glyphs you could still write a function to do it that would work most of the time. More if you could identify the exceptions to your default ⎕ML=3. .

Otherwise ...

There again there are only about eight hundred occurrencies of each of equal-underbar and right-shoe and about a thousand of up-arrow in FlipDB.

But to go back to John's thesis I think Dyalog might hope more realistically that the new primitive dyad will encourage users to go back to ⎕ML=2 which is the point after which dyadic left-shoe gained its new definition.

To go back to ⎕ML=1 might require a run-time intervention, a temporary bolt-on to the tracer (say), to flag the hits that count as the interpreter can only ascertain whether it's got a monad or a dyad at that time.
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: Fortuitous inverse

Postby Phil Last on Tue May 02, 2017 7:59 pm

This replaces a second identical copy of the above post. Dyalog was slow responding last evening and I seem to have hit "Submit" twice.
Last edited by Phil Last on Wed May 03, 2017 9:12 am, edited 1 time in total.
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex


Return to APL Chat

Who is online

Users browsing this forum: No registered users and 1 guest