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:
There was some relevant discussion in comp.lang.apl here: https://groups.google.com/forum/#!topic/comp.lang.apl/23LrwRZKmPs

On 6 July 2016 at 19:31, Xiao-Yong Jin <jinxiaoy...@gmail.com> wrote:
The following from GNU APL,

      (⊂[1]⍳2 3)+.+.+⊂[1]10×⍳2 3
 209 198
      (⊂[1]⍳2 3)(+.+).+⊂[1]10×⍳2 3
 209 198
      (⊂[1]⍳2 3)+.(+.+)⊂[1]10×⍳2 3
  33 66  66 66

do not agree with Dyalog APL,

      ⎕ML
3
      (⊂[1]⍳2 3)+.+.+⊂[1]10×⍳2 3
  165 242
      (⊂[1]⍳2 3)(+.+).+⊂[1]10×⍳2 3
  165 242
      (⊂[1]⍳2 3)+.(+.+)⊂[1]10×⍳2 3
  99 132

I’m not sure which one is at fault here.  Any idea?


Reply via email to