[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reassignment of a nested array element
From: |
Mr. Sunday |
Subject: |
Re: Reassignment of a nested array element |
Date: |
Sun, 05 Mar 2023 12:04:33 -0500 |
User-agent: |
Cyrus-JMAP/3.9.0-alpha0-183-gbf7d00f500-fm-20230220.001-gbf7d00f5 |
Thank you for your reply, Hans-Peter. Sorry for the delay; it took some time
to dig out my old interpreters. APL2, APL+Win, and Dyalog come up with the
answer I expect. I do not see why reassignment would retain the structure of
the prior contents. Is your point of view based upon selective assignment?
Inserting a comma in the left hand side gives the result you expect:
(,3⊃var)←⊂⊃'Susan' 'Mary' 'Annalisa'.
IBM APL2 2.0 Service Level 14
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 Susan
5 6 7 8 Mary
9 10 11 12 Annalisa
Dyalog 18.2.45505
⎕ml←3 ⋄ ⎕io←1 ⋄ 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 Susan
5 6 7 8 Mary
9 10 11 12 Annalisa
APL+Win 4.0
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 Susan
5 6 7 8 Mary
9 10 11 12 Annalisa
On Sat, Mar 4, 2023, at 14:25, 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.
>>
--
-- Everyday is Sunday.
- Reassignment of a nested array element, Mr. Sunday, 2023/03/04
- Re: Reassignment of a nested array element, Hans-Peter Sorge, 2023/03/04
- Re: Reassignment of a nested array element, Dr . Jürgen Sauermann, 2023/03/08
- Re: Reassignment of a nested array element, Hans-Peter Sorge, 2023/03/08
- Re: Reassignment of a nested array element, Dr . Jürgen Sauermann, 2023/03/09
- Re: Reassignment of a nested array element, Hans-Peter Sorge, 2023/03/09