bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Feature suggestion: multiple function arguments


From: Juergen Sauermann
Subject: Re: [Bug-apl] Feature suggestion: multiple function arguments
Date: Tue, 15 Mar 2016 16:56:37 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

Hi,

maybe, maybe not.

it seems like in APL2, / and friends (⌿ \ and ) are always operators.

In GNU APL / and friends are operators if their left argument is a function, and
functions if their left argument is a value.

That's why
1 2 /¨ 3 4 is evaluated directly and without a derived function in GNU APL.

The ISO standard lists Z←A/B and Z←A\B as mixed functions replicate (section 10.2.5) and expand (section 10.2.6),
and clearly not as operator (section 9).

I would also argue that there are good reasons for GNU APL to behave as it does (despite of
its APL2 incompatibility). Consider this:

      1 2 /¨ 3 4
 3  4 4
     
      Compress←{ ⍺ / ⍵ }
      1 2 Compress ¨ 3 4
 3  4 4


No surprize, right? But if we would always treat / as an operator, then the above would give two
different results and that would, in my opinion, be rather counter-intuitive.

And the syntax error is a mere consequence of / being a function in the example (you
cannot bind a function to its left argument with ().

/// Jürgen


On 03/15/2016 03:54 PM, Elias Mårtenson wrote:
On 15 March 2016 at 22:47, Jay Foad <address@hidden> wrote:
On 15 March 2016 at 13:24, Elias Mårtenson <address@hidden> wrote:
> On 15 March 2016 at 21:14, Jay Foad <address@hidden> wrote:
>>
>>       1 2 /¨ 3 4 ⍝ in APL2 this parses as (1 2 /)¨ 3 4
>>  3 3 3  4 4 4
>
> Are you saying that (1 2 /)¨ 3 4 is syntactically correct in APL2?

Yes. / is an operator, so 1 2/ is a derived function, and you can
parenthesise any function-valued _expression_.

So is the SYNTAX ERROR from GNU APL here a bug then? 


reply via email to

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