|
From: | Juergen Sauermann |
Subject: | Re: [Bug-apl] multiple inner product |
Date: | Thu, 07 Jul 2016 14:29:36 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
Hi, it looks to me like that the discussion on comp.lang.apl exactly hits the issue. I have simplified Xiao-Yong's example a little and compared GNU APL with IBM APL2. In IBM APL2 we have: Q←(1 2) (3 4) ⍴Q 2 ≡Q 2 DISPLAY Q ┏→━━━━━━━━━━┓ ┃┏→━━┓ ┏→━━┓┃ ┃┃1 2┃ ┃3 4┃┃ ┃┗∼━━┛ ┗∼━━┛┃ ┗∊━━━━━━━━━━┛ +/Q 4 6 ⍴+/Q ≡+/Q 2 DISPLAY +/Q ┏━━━━━┓ ┃┏→━━┓┃ ┃┃4 6┃┃ ┃┗∼━━┛┃ ┗∊━━━━┛ Q +.+ Q 8 12 ⍴Q +.+ Q ≡Q +.+ Q 3 DISPLAY Q +.+ Q ┏━━━━━━━━┓ ┃┏━━━━━━┓┃ ┃┃┏→━━━┓┃┃ ┃┃┃8 12┃┃┃ ┃┃┗∼━━━┛┃┃ ┃┗∊━━━━━┛┃ ┗∊━━━━━━━┛ In GNU APL we have: Q←(1 2) (3 4) ⍴Q 2 ≡Q 2 4 ⎕CR Q ┏→━━━━━━━━━━┓ ┃┏→━━┓ ┏→━━┓┃ ┃┃1 2┃ ┃3 4┃┃ ┃┗━━━┛ ┗━━━┛┃ ┗∊━━━━━━━━━━┛ ⍴+/Q ≡+/Q 2 4 ⎕CR +/Q ┏━━━━━┓ ┃┏→━━┓┃ ┃┃4 6┃┃ ┃┗━━━┛┃ ┗∊━━━━┛ ⍴Q+.+Q ≡Q+.+Q 2 4 ⎕CR Q+.+Q ┏━━━━━━┓ ┃┏→━━━┓┃ ┃┃8 12┃┃ ┃┗━━━━┛┃ ┗∊━━━━━┛ That means in short that GNU APL and IBM APL2 have identical results for the +/Q but for Q+.+Q the IBM APL2 result is nested one level deeper. This is a discrepancy between IBM APL2 and the ISO standard. Even though I normally go for IBM compatibility in such cases, I would prefer ISO in this case. It could even be that IBM has fixed this in the meantime (my APL2 is fairly old). /// Jürgen On 07/07/2016 12:57 PM, Jay Foad wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |