bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Inconsistent behaviour or operator /


From: Juergen Sauermann
Subject: Re: [Bug-apl] Inconsistent behaviour or operator /
Date: Sun, 12 Jun 2016 14:26:37 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

Hi Elias,

yes, I believe so.

The ISO standard,
chapter 9.2.1 Reduction, allows 2 different variants for reduction called the
Enclose-Reduction-Style (aka. APL2 style) and the Insert-Reduction-Style (aka. Sharp/J style).

GNU APL uses the APL2 style for compatibility with IBM APL2. The APL2 style requires that
the rank of the reduction result is, if possible, one less than the rank of the argument.

In your example, the argument has rank 1 and therefore the result must have rank 0:

      ⍴⍴ (1 2) (2 3) (3 4)
1
      ⍴⍴ ,/ (1 2) (2 3) (3 4)
0


For that reason the result is enclosed to make it a scalar. The
Insert-Reduction-Style
would have produced the result that you had expected.

/// Jürgen


On 06/12/2016 12:20 AM, Elias Mårtenson wrote:
The following gives a very obvious result:

      (1 2),(2 3),(3 4)
┏→━━━━━━━━━━┓
┃1 2 2 3 3 4┃
┗━━━━━━━━━━━┛

Assuming that the / operator splices the function between each value, you'd expect the following to yield the same result, but it becomes boxed. Is there an explanation for this?

      ,/ (1 2) (2 3) (3 4)
┏━━━━━━━━━━━━━┓
┃┏→━━━━━━━━━━┓┃
┃┃1 2 2 3 3 4┃┃
┃┗━━━━━━━━━━━┛┃
┗∊━━━━━━━━━━━━┛

Regards,
Elias


reply via email to

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