Perhaps you're misunderstanding how squad indexing works?

      ⎕←t←5 5⍴⎕A
ABCDE
FGHIJ
KLMNO
PQRST
UVWXY
      (1 3 5)(1 3 5)⌷t
ACE
KMO
UWY
      t[1 3 5;1 3 5]≡(1 3 5)(1 3 5)⌷t
1

Perhaps you wanted to use something like Dyalog's choose indexing?

      x[(∊2=⍴¨x)/,s]
┌──┬──┐
│XX│XX│
└──┴──┘

Jay.

On Mon, 5 Nov 2018 at 13:07, Juergen Sauermann <
[email protected]> wrote:

> Hi Hans-Peter,
>
> I tried to check your example with IBM APL2 and it
> gives me a RANK ERROR on
>
> ((∊2=⍴¨x)/,s)⌷x
>
> ⍴((∊2=⍴¨x)/,s) is 3 and ⍴x is 4 4.
> I have earlier noticed some differences in nesting levels between different 
> APL interpreters that
> could be traced back to what the ISO standard calls "reduction styles" (an 
> implementation parameter).
> I suppose the reduction style also matters for the EACH operator
>
> For example, GNU APL and IBM APL2 use the "Enclose-Reduction-Style" while 
> Dyalog APL uses
> the "Insert-Reduction-Style". So I wonder where your examples originate.
>
> It would help me a lot if you could break down your examples into individual 
> steps like
> *4⎕CR    y1←⍴¯x**
> 4⎕CR    y2←2=y1
> **4⎕CR    y3←∈y2**4⎕CR    y**3**/,s**...*
> so that I can see the expected intermediate results (and a hint which ones 
> are wrong)
>
> Best Regards,
> /// Jürgen Sauermann
>
>
> On 11/05/2018 12:49 AM, Hans-Peter Sorge wrote:
>
> Hi Jürgen,
>
> it looks like there is some inconsistency.
>
>       x←4 4⍴'XX' '' '' '' '' '' '' ''
>
>       s←(⍳4)∘.,⍳4
>       s
>  1 1  1 2  1 3  1 4
>  2 1  2 2  2 3  2 4
>  3 1  3 2  3 3  3 4
>  4 1  4 2  4 3  4 4
>
>
>       ((∊2=⍴¨x)/,s)⌷x
>   XX
>   XX
> ----- expected (no leading empty elements)
>  XX
>  XX
>
>       ⍴((∊2=⍴¨x)/,s)⌷x
>  2 2  ----- expected 2 1 (only one column)
>       ⍴¨((∊2=⍴¨x)/,s)⌷x
>  0  2
>  0  2
>  ----- expected (no leading empty elements)
>  2
>  2
> -------------------------------------
>       x←2 2⍴'XX' '' '' ''
>       s←(⍳2)∘.,⍳2
>       ((∊2=⍴¨x)/,s)⌷x
> RANK ERROR
>       ((∈2=⍴¨x)/,s)⌷x
>       ^             ^
> ------ expected (no RANK ERROR, equivalent result as in previous 4x4
> matrix)
>  XX
>
> Best Regards
> Hans-Peter
>
>
>
>
>
>
>

Reply via email to