Hi
Hans-Peter,
I believe that GNU APL, Dyalog, and IBM APL2 only now
behave
the same while GNU APL did not before the fix:
TryAPL Version 3.6.1 (enter
]State for details)
Tue Mar 07 2023 16:59:04
Copyright (c) Dyalog Limited 1982-2023
Q←0 0 0
(3⊃Q)←2 2⍴2
Q
┌─┬─┬───┐
│0│0│2 2│
│ │ │2 2│
└─┴─┴───┘
(3⊃Q)←33
Q
0 0 33
GNU APL SVN 1656:
Q←0 0 0
(3⊃Q)←2 2⍴2
Q
0 0 2 2
2 2
(3⊃Q)←33
Q
0 0 33
The cleanest way to achieve the previous (incompatible)
behaviour in GNU APL is to disclose the left of →
Q←0 0 0
(3⊃Q)←2 2⍴2
Q
0 0 2 2
2 2
(⊃3⊃Q)←33
Q
0 0 33 33
33 33
For dubious reasons this does not work on Dyalog
because they only assign the first item:
(⊃3⊃Q)←33
Q
┌─┬─┬────┐
│0│0│33 2│
│ │ │ 2 2│
└─┴─┴────┘
which is not consistent with (Dyalog):
W←⊂2 2⍴2
W
┌───┐
│2 2│
│2 2│
└───┘
(⊃W)←33
W
33
Although this is a discrepancy between GNU APL and
Dyalog,
I believe that Dyalog is wrong here. IBM APL2 says
DOMAIN ERROR in this case.
Best Regards,
Jürgen
On 3/6/23 9:16 PM, Hans-Peter Sorge wrote:
Hello Jürgen,
I agree with your case 1/2 Statement.
The examples I was showing is actually "off by 1".
I was referring to
(1/3⊃V)←1
having
a←1
b←'ABC'
c←3 3⍴⍳9
V←a b c
(3⊃V)
1
2 3
4 5 6
7 8 9
As expected with case 1:
(3⊃V)←1
V
1 ABC 1
V←a b c
Not
expected:
(1/3⊃V)←1
V
1 ABC 1
Expected:
(1/3⊃V)←1
V
1
ABC 1 1 1
1 1 1
1 1 1
as with
(1/c)←1
c
1 1 1
1 1 1
1 1 1
And that's Dyalog too.
Please restore compatibility:-)
Best Regards
Hans-Peter
Am 06.03.23 um 16:10 schrieb Dr. Jürgen
Sauermann:
Gentlemen,
thanks for the discussion, fixed in SVN 1655.
Hans-Peter, I am sorry that this change creates an
incompatibility in your code.
My thinking for the old solution was this:
V←0 0 0 ◊ V←1 ◊ V ∩ case 1.
1
V←0 0 0 ◊ V[]←1 ◊ V ⍝ case
2.
1 1 1
This applies to GNU APL, APL2, and Dyalog. The
question is then if (A⊃V) in
(A⊃B)←X should behave like case 1 or like case 2
above. The case (A⊃B)←X
with nested (A⊃B)is described neither in the "IBM
APL2 Language Reference"
nor in the "ISO 13751" standard, leaving some room
for interpretation.
However, both APL2 and Dyalog agree on case 1 and
therefore I changed
GNU APL to behave the same.
Best Regards,
Jürgen
On 3/4/23 8:25 PM, Hans-Peter Sorge wrote:
Hi,
Works as expected
⊃'Sue' 'Maria' 'Annalisa'
is an array 3 by 8.
⊂⊃'Susan' 'Mary' 'Annalisa'
is an element (⊂) of a 3 by 8 array (⊃'Susan'
'Mary' 'Annalisa' ).
Finally each element in ⊃'Sue' 'Maria' 'Annalisa'
gets assigned an array of ⊃'Susan' 'Mary'
'Annalisa'
Greetings
Hans-Peter
Am 04.03.23 um 16:53 schrieb Mr. Sunday:
Hi,
I have an issue with reassigning an element of a
nested array. Here is an example.
14535:15a:~% apl --version
BUILDTAG:
---------
Project: GNU APL
Version / SVN: 1.8 / SVN: 1651M
Build Date: 2023-03-02 00:25:07 UTC
Build OS: Darwin 21.6.0 x86_64
config.status: default ./configure options
Archive SVN: 1621
var←0 0 0 ⋄ (1⊃var)←5 4 ⋄ (2⊃var)←3 4⍴⍳12 ⋄
(3⊃var)←⊃'Sue' 'Maria' 'Annalisa' ⋄ var ⋄
(3⊃var)←⊂⊃'Susan' 'Mary' 'Annalisa' ⋄ var
┌→────────────────────────────┐
│┌→──┐ ┌→─────────┐ ┌→───────┐│
││5 4│ ↓1 2 3 4│ ↓Sue ││
│└───┘ │5 6 7 8│ │Maria ││
│ │9 10 11 12│ │Annalisa││
│ └──────────┘ └────────┘│
└ϵ────────────────────────────┘
┌→───────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│┌→──┐ ┌→─────────┐
┌→──────────────────────────────────────────────────────────────────────────────────────┐│
││5 4│ ↓1 2 3 4│ ↓┌→───────┐ ┌→───────┐
┌→───────┐ ┌→───────┐ ┌→───────┐ ┌→───────┐
┌→───────┐ ┌→───────┐││
│└───┘ │5 6 7 8│ │↓Susan │ ↓Susan │
↓Susan │ ↓Susan │ ↓Susan │ ↓Susan │
↓Susan │ ↓Susan │││
│ │9 10 11 12│ ││Mary │ │Mary │
│Mary │ │Mary │ │Mary │ │Mary │
│Mary │ │Mary │││
│ └──────────┘ ││Annalisa│ │Annalisa│
│Annalisa│ │Annalisa│ │Annalisa│ │Annalisa│
│Annalisa│ │Annalisa│││
│ │└────────┘ └────────┘
└────────┘ └────────┘ └────────┘ └────────┘
└────────┘ └────────┘││
│
│
││
│ │┌→───────┐ ┌→───────┐
┌→───────┐ ┌→───────┐ ┌→───────┐ ┌→───────┐
┌→───────┐ ┌→───────┐││
│ │↓Susan │ ↓Susan │
↓Susan │ ↓Susan │ ↓Susan │ ↓Susan │
↓Susan │ ↓Susan │││
│ ││Mary │ │Mary │
│Mary │ │Mary │ │Mary │ │Mary │
│Mary │ │Mary │││
│ ││Annalisa│ │Annalisa│
│Annalisa│ │Annalisa│ │Annalisa│ │Annalisa│
│Annalisa│ │Annalisa│││
│ │└────────┘ └────────┘
└────────┘ └────────┘ └────────┘ └────────┘
└────────┘ └────────┘││
│
│
││
│ │┌→───────┐ ┌→───────┐
┌→───────┐ ┌→───────┐ ┌→───────┐ ┌→───────┐
┌→───────┐ ┌→───────┐││
│ │↓Susan │ ↓Susan │
↓Susan │ ↓Susan │ ↓Susan │ ↓Susan │
↓Susan │ ↓Susan │││
│ ││Mary │ │Mary │
│Mary │ │Mary │ │Mary │ │Mary │
│Mary │ │Mary │││
│ ││Annalisa│ │Annalisa│
│Annalisa│ │Annalisa│ │Annalisa│ │Annalisa│
│Annalisa│ │Annalisa│││
│ │└────────┘ └────────┘
└────────┘ └────────┘ └────────┘ └────────┘
└────────┘ └────────┘││
│
└ϵ──────────────────────────────────────────────────────────────────────────────────────┘│
└ϵϵ──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
-- Everyday is Sunday.