bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] indexing of the array


From: Jay Foad
Subject: Re: [Bug-apl] indexing of the array
Date: Mon, 7 Mar 2016 09:44:22 +0000

Right. This is one of the few cases where APL2 broke compatibility
with first-generation APL, where 7 8 9[2] was 8.

Personally I think the APL2 way is better, because A[B] C[D] parses as
(A[B])(C[D]). This makes much more sense to me than the Dyalog
parsing, which is ((A[B]) C)[D].

Jay.

On 5 March 2016 at 20:17, Juergen Sauermann
<address@hidden> wrote:
> Hi,
>
> so Dyalog APL behaves differently than IBM APL2.
> In such conflict cases GNU APL almost always follows IBM APL2.
>
> /// Jürgen
>
>
> On 03/05/2016 05:20 PM, Alexey Veretennikov wrote:
>
> Hi,
>
> I've just checked, Dyalog APL returns exactly what you are expecting
> from it:
>
>       2 a[1]
> 2
>       b←⍳5
>       9 8 b
> 9 8  1 2 3 4 5
>       9 8 b[2]
> 8
>
>
> Elias Mårtenson <address@hidden> writes:
>
> On 5 March 2016 at 19:12, Juergen Sauermann <address@hidden>
> wrote:
>
>
>  Hi Alexey,
>
>  the IBM APL2 binding rules say that [] binds stronger than vector notation
> (IBM APL2
>  language reference page 34). That is,
>
>  100 200[1] is 100 (200[1])
>
>  IBM APL2 behaves in the same way as GNU APL.
>
>
> At first I was confused about this (and even started writing this email
> expressing that confusion). Then I
> realised that it is Dyalog that must have a very bizarre evaluator.
>
> What does the following do in Dyalog?
>
> a ← 1
> 2 a[1]
>
> If vector notation binds string that dereference, then this should return 2.
>
> But if that is the case, what does the following return?
>
> b ← ⍳5
> 9 8 b
> 9 8 b[2]
>
> Again, if Dyalog is consistent, it should return 8, and not 9 8 2 which is
> the case in GNU APL.
>
> However, if Dyalog returns the same value as GNU APL, that means that the
> parser changes the binding
> strength depending on the type of arguments. That sounds incredibly weird to
> me.
>
> Regards,
> Elias
>
>



reply via email to

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