2

I am playing around with GNU APL, but my experiments quickly reached an impasse. This is what happened:

x←1 2 3 4 5
⍝ build the matrix u where u_{ij} = x_i + x_j,
⍝ then filter the entries equal to 6
u←6=x∘.+x

So far so good, u is a flipped identity matrix, as expected.

Now, I would like to get the indices of the nonzero entries, so I try

⍸u

but here I get a SYNTAX ERROR++ warning. The same error appears when entering any of the following commands:

{⍸6=⍵∘.+⍵}x
{⍸6=⍵∘.+⍵} 1 2 3 4 5
{⍸6=⍵∘.+⍵} ⍳5
app←{⍸6=⍵∘.+⍵}

I suspect this is somehow a problem on my local installation, as I cannot reproduce the errors on the online interpreter.

Did somebody see this problem before? I compiled APL from source (ubuntu, GCC), the error appears in both versions 1.7 and 1.8. I could reproduce the error with the precompiled binary available from GNU's mirror. I wonder if I made a mistake in compiling and installing GNU APL, but the only non-standard thing I did was to unset the flag WERROR from the Makefile in the src folder, otherwise it would not compile due to an unchecked return value in the source.

J. D.
  • 279
  • 1
  • 9

1 Answers1

2

I emailed bug-apl@gnu.org to get someone to have a look. This is the response I got:

no idea. I am getting this:

      ⍝ build the matrix u where u_{ij} = x_i + x_j,
      ⍝ then filter the entries equal to 6
      u←6=x∘.+x
 
      ⍸u  1 5  2 4  3 3  4 2  5 1

SVN is 18005 aka. 1474 and the related code has not changed für years.

Regarding:

"otherwise it would not compile due to an unchecked return value in the source."

please report this kind of problems to bug-apl@gnu.org with a printout of the compiler's error message. Compilers are becoming increasingly picky about various this which causes code to happily compile for a decade an then out of a sudden raise a warning with a new compiler code.

I have the ambition that GNU APL compiles on almost all platforms and compilers and since I cannot test all platforms on my own it is important that users like you with a different platform inform me about problems.

Best Regards,
[Dr.] Jürgen [Sauermann, the main developer of GNU APL]


Edit per the GNU APL mailing list:

Support for was added in December 2020 (r1368). Released tarballs don't have it; you will have to compile the development version from the repository to get it.

Note that tarballs are not the preferred way of installing GNU APL.

Adám
  • 6,573
  • 20
  • 37
  • It seems that the source downloads from FTP (i.e. the `apl-1.8-0.src.rpm`) doesn't have the impl of `⍸`, but the git repository does. Maybe that's the issue here? – dzaima Jun 19 '21 at 11:35
  • I had no hope of receiving an answer so quickly! Thank you very much! – J. D. Jun 20 '21 at 14:49
  • As for the compiler warnings, a couple that I found are these: `APmain.cc:137:1: warning: 'noreturn' function does return } ^` and `Shape.hh: In member function ‘Shape Shape::insert_axis(Axis, ShapeItem) const’: Shape.hh:68:46: error: ‘*(const ShapeItem*)((char*)& ret + *8 +8)’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 68 | loop(r, MAX_RANK) rho[r] = other.rho[r];` there are others but I can't fit them all here. The compiler is g++ 10.3.0. – J. D. Jun 20 '21 at 14:58
  • @J.D. Will you forward that to the mailing list? – Adám Jun 20 '21 at 15:00
  • 1
    Hi @Adám no need to worry about that: I re-installed GNU APL from the repository (same compiler, -Werror enabled), and all the warnings disappeared. I would recommend the team to update the tarballs to a more recent version, or alternatively to remove the -Werror flag, though. My problem with `⍸` is completely solved now! – J. D. Jun 20 '21 at 19:31