bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disclose fails with mixed ranks


From: Jay Foad
Subject: Re: Disclose fails with mixed ranks
Date: Sat, 25 Sep 2021 09:36:08 +0100

Jürgen,

Thank you, I had forgotten that ISO included the Rank operator!

Jay.

On Fri, 24 Sept 2021 at 19:27, Dr. Jürgen Sauermann
<mail@jürgen-sauermann.de> wrote:
>
> Hi,
>
> if we look at the rank operator in ISO APL (which is not present in IBM
> APL 2) then they
> define an operation "conform" which reads:
>
> *conform: *The shape of a result is the frame of the argument (relative
> to the cells to
> which the function applies) catenated with the shape of the individual
> results produced
> by applying the function to the individual cells. If the results do not
> agree in shape
> they are brought to a common shape as follows:
> If the ranks differ, they are brought to a common maximum rank by
> reshaping each
> individual result to introduce leading unit lengths.
> If the individual shapes differ (after being brought to a common rank),
> each is brought
> to a common shape by using take on each individual result, using as the
> argument
> to take the shape which is the maximum over the shapes.
>
> Even though ISO defined this operation only for conforming the argument
> of the rank operator,
> it seems reasonable to me to use it also for disclose as opposed to
> using a different operation
> to conform the argument of disclose. In particular since the
> "deficiency" of the arguments (i.e.
> differing ranks of the items) is exactly the same in both cases.
>
> Best Regards,
> Jürgen
>
>
> On 9/24/21 7:30 PM, Jay Foad wrote:
> > Apart from compatibility with Rank (which didn't exist in Dyalog
> > before 14.0), why do you think adding leading ones to the shape is
> > "obvious"? Why not trailing ones, for example?
> >
> > Jay.
> >
> > On Fri, 24 Sep 2021, 15:48 Elias Mårtenson, <lokedhs@gmail.com
> > <mailto:lokedhs@gmail.com>> wrote:
> >
> >     Fair enough. That said, I think dzaima/APL implements it. As does
> >     KAP now.
> >
> >     It's also a pretty obvious implementation, and the behaviour
> >     orthogonal, instead of having a special case for scalars.
> >
> >     Regards,
> >     Elias
> >
> >     On Fri, 24 Sept 2021 at 22:35, Jay Foad <jay.foad@gmail.com
> >     <mailto:jay.foad@gmail.com>> wrote:
> >
> >         Elias,
> >
> >         This was an extension to Mix in Dyalog 14.0
> >         (http://docs.dyalog.com/14.0/Dyalog%20APL%20Release%20Notes.pdf
> >         <http://docs.dyalog.com/14.0/Dyalog%20APL%20Release%20Notes.pdf>
> >         p22)
> >         inspired by the way the Rank operator assembles results with
> >         differing
> >         ranks. I'm not aware of any other APL2-like APLs implementing this
> >         extension.
> >
> >         Jay.
> >
> >         On Wed, 22 Sept 2021 at 14:20, Elias Mårtenson
> >         <lokedhs@gmail.com <mailto:lokedhs@gmail.com>> wrote:
> >         >
> >         > The following expression should work, if I'm reading the ISO
> >         spec correctly:
> >         >
> >         > ⊃ 3 (1 2) (2 2 ⍴ 0 1 2 3)
> >         >
> >         > It does work on Dyalog, and gives the expected result.
> >         >
> >         > Regards,
> >         > Elias
> >
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]