From Newsgroup: comp.lang.apl
After Dyalog adopted the definition of Replicate used by NARS, APL2 developed another definition, which differs in its handling of negative numbers in the left argument. In APL2, a negative number does not "consume" an element of the right argument, so that instead of (reori|)=reori|, we have (+/0renri|)=reori|. Developers of XAPL noticed that both extensions can be supported simultaneously: if the left argument has any negative numbers, the interpreter can tell which one the programmer meant by checking whether the right argument's length is equal to the left (NARS-style) or shorter (APL2-style). In fact, APLX already does this:
```
APLX for Windows
Copyright (C) 2001-2010 MicroAPL Ltd
WS Size = 20.0MB, Version = 5.1.0
CLEAR WS
1 ->2 3 2 / 10 20 30
10 0 0 20 20 20 30 30
->2 3 2 / 10 20 30
0 0 20 20 20 30 30
```
On Monday, August 30, 2021 at 10:44:25 PM UTC+1, J. Clarke wrote:
On Mon, 30 Aug 2021 13:24:54 -0700 (PDT), Brian McGuinness <b.mcgui...@gmail.com> wrote:
NARS2000 requires the left and right arguments to have the same length:
1 ->2 3 2 / 10 20 30
LENGTH ERROR
1 ->2 3 2 / 10 20 30
?
2 3 2 / 10 20 30
0 0 20 20 20 30 30
GNU APL requires the number of nonnegative values in the left argument to match the number of items in the right argument:
1 ->2 3 2 / 10 20 30
10 0 0 20 20 20 30 30
2 3 2 / 10 20 30
LENGTH ERROR
2 3 2/10 20 30
^ ^
The GNU APL approach seems to agree with the description of replicate in the IBM APL2 manual.
The following trace is from Dyalog:
1 ->2 3 2 / 10 20 30
LENGTH ERROR
1 ->2 3 2/10 20 30
^
I believe emulating Dyalog is a better choice than emulating APL2,
which seems to be starting down the path to abandonware.
--- Synchronet 3.21d-Linux NewsLink 1.2