We're proposing to fix what might qualify as the longest standing bug in Dyalog. Currently, ⍳⍬ returns ⎕io; it should return ⊂⍬. To convince you that this is correct, look at the following sequence:
)copy dfns.dws
...
disp ⍳¨ ⍳¨ 3 2 1 0 ⍝ current behaviour
┌→──────────────────┬─────────┬─┬─┐
│┌→────┬─────┬─────┐│ │ │ │
│⍒1 1 1│1 1 2│1 1 3││┌→──┬───┐│ │ │
│├~───→┼~───→┼~───→┤│↓1 1│1 2││1│1│
││1 2 1│1 2 2│1 2 3││└~─→┴~─→┘│ │ │
│└~───→┴~───→┴~───→┘⍒ ↓ │ │
└──────────────────→┴────────→┴→┴─┘
disp ⍳¨ ⍳¨ 3 2 1 0 ⍝ proposed behaviour
┌→──────────────────┬─────────┬─┬───┐
│┌→────┬─────┬─────┐│ │ │ │
│⍒1 1 1│1 1 2│1 1 3││┌→──┬───┐│ │┌─┐│
│├~───→┼~───→┼~───→┤│↓1 1│1 2││1││0││
││1 2 1│1 2 2│1 2 3││└~─→┴~─→┘│ │└⊖┘│
│└~───→┴~───→┴~───→┘⍒ ↓ │ │
└──────────────────→┴────────→┴→┴───┘
Notice how the sequences differ in the last item.
The correction would mean that:
⍵≡⍵[⍳⍴⍵] ⍝ for all, including scalar, ⍵.
and that:
(nelts¨ ⍳⍵) ∧.= nelts ⍵ ⍝ where: nelts←{⎕io⊃⍴,⍵}
If this change would cause you a problem, now would be a good time to mention it.
John.
(muse: From a consistency point of view, there's an argument for distinguishing ⍳3 from ⍳,3. This would enclose the penultimate item in the above sequence. But we can't to this because it would [a] break the APL standard, and [b] break everyone's code.)
Proposed changed to ⍳⍬
Re: Proposed changed to ⍳⍬
Yes, this will still be the case. With the fix:
Dyalog APL/W Version 13.0.5135
Serial No : 000000
Unicode Edition
DEBUG Build
Fri Apr 23 18:21:47 2010
clear ws
{⊃⍴⍴⍳⍵}¨0 1 2 3 4 5⍴¨0
0 1 2 3 4 5
Dyalog APL/W Version 13.0.5135
Serial No : 000000
Unicode Edition
DEBUG Build
Fri Apr 23 18:21:47 2010
clear ws
{⊃⍴⍴⍳⍵}¨0 1 2 3 4 5⍴¨0
0 1 2 3 4 5