[Top][All Lists]

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

Re: ⍬ bug?

From: Dr . Jürgen Sauermann
Subject: Re: ⍬ bug?
Date: Tue, 24 Dec 2019 16:36:02 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Thunderbird/60.6.1


yes. In some sense. Actually

1 2 X 4

is the same as 1 2 (X) 4

because there is a rule that says so. However, the point here is that

1 2 X 4

can be (very) different from

(1 2 X 4)

The difference does not occur in simple examples, but may in more complex ones.

1 2 X 4   + 1

is generally
different from

(1 2 X 4)   + 1

simply because the order of evaluation differs between X and +. More generally, if
you put the left argument of a dyadic function in parentheses then that most likely
(though not neccessarily) changes the valuation order (and hence the result). I know
that this is odd, but so are niladic functions when it comes to parsing. According to
the IBM APL 2 parentheses rules, the parantheses around (⍬) are redundant (and
make no difference while the
parentheses around (⍳0) are not redundant. As a
consequence, even though ⍳0 yields essentially ⍬ they are not entirely equivalent.

Best Regards,
Jürgen Sauermann

On 12/24/19 3:16 PM, Elias Mårtenson wrote:
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


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:



Both V and F result in the same value :


However, they are parsed differently:

      2 V 3⊃a

      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

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:

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

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


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 )


reply via email to

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