[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-apl] Operator Idiosyncrasies
From: |
Louis de Forcrand |
Subject: |
Re: [Bug-apl] Operator Idiosyncrasies |
Date: |
Sun, 13 Sep 2015 09:14:49 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Mike Duvos <address@hidden> writes:
>
> Just in case it isn't instantly obvious what's wrong in the prior post,
GNU APL is returning the wrong thing for dyadic reduce with a left
argument of zero and a scalar right argument.If f is a scalar function,
and X is a non-empty vector, or a scalar which gets treated as a 1-element
vector, then the expression... 0 f/ XShould return a vector of length
1+⍴,X filled in with the identity for f.
Some examples... 0 +/ 990 0 0 +/ 10 20 300 0 0 0
0 ×/ 100 200 300 4001 1 1 1 1In GNU APL... 0 +/ 9999
And that's why the two results in the prior post differ.
>
Tried this and I think GNU APL works with vectors of more than one value.
So:
0+/100 200 300 400 0+/9 9
0 0 0 0 0 0 0 0
This is correct.
0+/100 0+/99
100 99
This is not.
I don't quite understand how this syntax is supposed to yield this result,
as +/ should add all of the values in the left argument together, and
then the 0 wouldn't have much use.
Apparently it works though. I also tried it with variables and
multiple-depth vectors:
X←99
0+/X
99
Y←X X
0+/Y
0 0 0
0+/ ¨ Y
99 99
X←9 9
0+/X
0 0 0
Y←X X
0+/Y
0 0 0 0 0 0
0+/ ¨ Y
0 0 0 0 0 0
This all coincides with the same operation without vars or
multiple-depth vectors.
Best regards,
Louis