bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Selective assignment bug


From: Mr. Brian B. McGuinness
Subject: Selective assignment bug
Date: Thu, 7 Jan 2021 19:13:26 +0000

I was trying examples of APL code from the book "APL2 At a Glance" in order to become more familiar with APL2 features.  I found an example that doesn't work.

      ]BOXING 8
      SA←10 'ABC' (3 3⍴⍳9) 20 (5 6)
      SA
┌→────────────────────────┐
│10 ┌→──┐ ┌→────┐ 20 ┌→──┐│
│   │ABC│ ↓1 2 3│    │5 6││
│   └───┘ │4 5 6│    └───┘│
│         │7 8 9│         │
│         └─────┘         │
└∊────────────────────────┘

      ,2 2↑3⊃SA
┌→──────┐
│1 2 4 5│
└───────┘

So far, so good.  But when I try the selective assignment I get

      (,2 2↑3⊃SA)←'WXYZ'
      SA
┌→──────────────────┐
│10 ┌→──┐ Z 20 ┌→──┐│
│   │ABC│      │5 6││
│   └───┘      └───┘│
└∊──────────────────┘

when according to the book I should get

┌→────────────────────────┐
│10 ┌→──┐ ┌→────┐ 20 ┌→──┐│
│   │ABC│ ↓W X 3│    │5 6││
│   └───┘ │Y Z 6│    └───┘│
│         │7 8 9│         │
│         └─────┘         │
└∊────────────────────────┘

which is what I would expect.

I hope that this information proves useful. 

I am having fun experimenting with GNU APL and exploring APL2 features.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]