bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] crash on each of empty


From: Juergen Sauermann
Subject: Re: [Bug-apl] crash on each of empty
Date: Fri, 16 May 2014 16:40:29 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5

Hi David,

not sure if it contradicts.

(1) First of all the ISO standard says this about A f¨ B and f¨ B:

9.2.6 Each
...
For both forms:
   If B is not empty, Signal domain-error.
...

I believe this is a typo and they mean "if B is empty". Thus according to the ISO standard +¨'' is undefined.

(2) Then we have the IBM language reference. On page 56, "Fill Function for Primitive Scalar Functions"
they describe the fill function for scalar f (i.e. + in your example) which, as I read it, always returns
values with numeric 0 for all simple ravel elements.

On page 110, Figure 20 they give a completely different definition of the fill function for scalar function
as Z←(R) ≠ (L). As far as I can tell, both definitions are equivalent for dyadic scalar functions, but the
definition on page 110 does not work for monadic scalar functions due to the lack of L. If we fix that by
using Z←(R) ≠ (R) for monadic functions then both definitions become equivalent again.

GNU APL has hopefully implemented the description on page 56.

(3) But then, surprise, in IBM APL2 +¨'' returns:
┌⊖┐
│ │
└─┘
while GNU APL returns:
      +¨''
┌⊖┐
│0│
└─┘
My best explanation for this that IBM may have used the same fill function for + as for user-defined functions.

I feel more comfortable with the written documentation of IBM APL2 because it is rather difficult
to implement things based on what another implementation produces.

/// Jürgen


On 05/15/2014 06:49 PM, David B. Lamkins wrote:
Thank you. Confirmed working with the original test cases.

Pushing a bit further, I believe that the following behavior may still
be contrary to the IBM spec in SVN 268:

      +¨''
┌⊖┐
│0│
└─┘

Here we have a numeric function passed an empty character. Transforming
this via the identity given previously, we get the equivalent
_expression_:

      (⍴'')⍴⊂+↑''
DOMAIN ERROR
      (⍴'')⍴⊂+↑''
             ^^

(I don't know whether there's a corresponding case for ⍬. Is there a
primitive monadic function that only accepts character arguments?)







reply via email to

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