Dyalog 12.1 and Dyalog 11 return a different result.
I met this problem during tests of old funtions (built in Dyalog 10).
The following image shows an example of this difference.
I do not understand which behaviour is correct.
May be the opinions can be different.
a strange difference Dyalog 12.1 vs 11
- giangiquario
- Posts: 46
- Joined: Thu Nov 26, 2009 8:55 am
- Location: Milano, Italia
Re: a strange difference Dyalog 12.1 vs 11
Good question:
Broken down and in origin zero:
]display {⍵}w←0 3⍴(⍳4)0 0
┌→──────────────────────────────┐
⌽ ┌→──────┐ ┌→──────┐ ┌→──────┐ │
│ │0 0 0 0│ │0 0 0 0│ │0 0 0 0│ │
│ └~──────┘ └~──────┘ └~──────┘ │
└∊──────────────────────────────┘
]display {⍵}a←w[;0]
┌⊖──────────┐
│ ┌→──────┐ │
│ │0 0 0 0│ │
│ └~──────┘ │
└∊──────────┘
]display {⍵}b←⍬∘⍴¨0 1↓w
┌→──┐
⌽0 0│
└~──┘
]display a,b
┌→──────────────────────────────┐
⌽ ┌→──────┐ ┌→──────┐ ┌→──────┐ │
│ │0 0 0 0│ │0 0 0 0│ │0 0 0 0│ │
│ └~──────┘ └~──────┘ └~──────┘ │
└∊──────────────────────────────┘
So catenating a zero item nested vector and a zero row simple matrix now gives a zero row nested matrix. Interesting. The shape is correct so it's the depth that's changed.
There were problems with the types of the catenations of various pairs out of the three:
⍬, '' and (0⍴#)
which I understood to have been corrected such that the result takes its type from the left argument.
I guess this is a similar case.
Broken down and in origin zero:
]display {⍵}w←0 3⍴(⍳4)0 0
┌→──────────────────────────────┐
⌽ ┌→──────┐ ┌→──────┐ ┌→──────┐ │
│ │0 0 0 0│ │0 0 0 0│ │0 0 0 0│ │
│ └~──────┘ └~──────┘ └~──────┘ │
└∊──────────────────────────────┘
]display {⍵}a←w[;0]
┌⊖──────────┐
│ ┌→──────┐ │
│ │0 0 0 0│ │
│ └~──────┘ │
└∊──────────┘
]display {⍵}b←⍬∘⍴¨0 1↓w
┌→──┐
⌽0 0│
└~──┘
]display a,b
┌→──────────────────────────────┐
⌽ ┌→──────┐ ┌→──────┐ ┌→──────┐ │
│ │0 0 0 0│ │0 0 0 0│ │0 0 0 0│ │
│ └~──────┘ └~──────┘ └~──────┘ │
└∊──────────────────────────────┘
So catenating a zero item nested vector and a zero row simple matrix now gives a zero row nested matrix. Interesting. The shape is correct so it's the depth that's changed.
There were problems with the types of the catenations of various pairs out of the three:
⍬, '' and (0⍴#)
which I understood to have been corrected such that the result takes its type from the left argument.
I guess this is a similar case.
Re: a strange difference Dyalog 12.1 vs 11
Phil is right: Catenation of a pair of null arrays produces a null result. The prototypical item of this result is drawn from one of the arguments.
Prior to V12, the choice of which argument, left or right, should supply this item was "interesting":
From V12 onwards, this behaviour has been rationalised so that the prototypical item of a null catenate is always drawn from its left argument.
(Muse: this behaviour feels natural to me as long as we read APL from left to right)
Prior to V12, the choice of which argument, left or right, should supply this item was "interesting":
Code: Select all
display ⍬,'' ⍝ prototypical item from left arg.
┌⊖┐
│0│
└~┘
display '',⍬ ⍝ prototypical item from left arg.
┌⊖┐
│ │
└─┘
display ⍬,0⍴⊂0 0 ⍝ prototypical item from left arg.
┌⊖┐
│0│
└~┘
display (0⍴⊂0 0),⍬ ⍝ prototypical item from RIGHT arg V≤11
┌⊖┐
│0│
└~┘
From V12 onwards, this behaviour has been rationalised so that the prototypical item of a null catenate is always drawn from its left argument.
Code: Select all
display '',⍬ ⍝ prototypical item from left arg.
┌⊖┐
│ │
└─┘
display ⍬,'' ⍝ prototypical item from left arg.
┌⊖┐
│0│
└~┘
display ⍬,0⍴⊂0 0 ⍝ prototypical item from left arg.
┌⊖┐
│0│
└~┘
display (0⍴⊂0 0),⍬ ⍝ prototypical item from left arg V≥12
┌⊖──────┐
│ ┌→──┐ │
│ │0 0│ │
│ └~──┘ │
└∊──────┘
(Muse: this behaviour feels natural to me as long as we read APL from left to right)