bug-apl
[Top][All Lists]

## Re: ⍬ bug?

 From: Elias Mårtenson Subject: Re: ⍬ bug? Date: Tue, 24 Dec 2019 15:16:41 +0100

I think such a change would make sense. A niladic function is in some sense a shortcut to writing a specific value, so it should probably be treated as such.

It a little odd that:
1 2 X 4
is different from:
1 2 (X) 4

Regards,
Elias

On Tue, 24 Dec 2019, 14:48 Dr. Jürgen Sauermann, <mail@jürgen-sauermann.de> wrote:
Hi David,

not sure either if this is a bug. The APL standard has quite a specification gap
when it comes to binding strength. In GNU APL, the binding between values
(aka strand notation) is stronger than the binding between values and functions.

For example:

V←⍳0

∇Z←F
Z←⍳0

Both V and F result in the same value :

V≡F
1

However, they are parsed differently:

2 V 3⊃a
3

2 F 3⊃a
2    99

In the first case:
2 V 3⊃a the value V binds strongly to 2 and 3 so that value (2 V 3)
becomes the left argument of . In the second case:
2 F 3 the value 3 binds
stronger to than to F so that first
is evaluated 3⊃a and then the result of is
tied to the F and 2.

In GNU APL is a niladic function, so it behaves like F above.

This behaviour could be changed, but I hesitate to do that since it might break
existing code. The impact of such a change would not only affect but all niladic
functions.

Best Regards,
Jürgen Sauermann

On 12/24/19 2:49 AM, David Tran wrote:
Ooops, missing something on my examples, correction:  ( missing ⊂ on ⍳3 )

a ← 'abc'(⊂⍳3)99

the 3 examples are the same:
2(⍳0)3⊃a
2⍬3⊃a
(2⍬3)⊃a

On Mon, Dec 23, 2019 at 7:20 PM David Tran <address@hidden> wrote:
Hi,

Not sure this is a bug or not, for me, (⍳0) ≡ ⍬, so it seems that both can be replaced each other; consider below example:

a←'abc'(⍳3)99

2(⍳0)3⊃a ⍝ ≡ 3
2⍬3⊃a ⍝ ≡ 2 ⍬ 99
(2⍬3)⊃a ⍝ ≡ 3

Doesn't the second example should return 3 as first example, without the need parentheses as third example?

(btw. my version is build from SVN around Oct )

Thanks,
Dave

reply via email to