Disclose fails with mixed ranks

2021-09-22 Thread Elias Mårtenson
The following expression should work, if I'm reading the ISO spec correctly:

⊃ 3 (1 2) (2 2 ⍴ 0 1 2 3)

It does work on Dyalog, and gives the expected result.

Regards,
Elias


Re: Disclose fails with mixed ranks

2021-09-22 Thread Louis Chretien via Bugs and suggestions for GNU APL
And what is the correct answer?

I tried it with APL/X 5.1, and i get the same “RANK ERROR” as in GNU APL.

If i understand disclose correctly, the right argument are nested elements, but 
of a shape that allows for them to be laminated into a matrix as a result. 
Having a scalar, a vector and a matrix is bound to create difficulty.

> On Sep 22, 2021, at 09:16, Elias Mårtenson  wrote:
> 
> The following expression should work, if I'm reading the ISO spec correctly:
> 
> ⊃ 3 (1 2) (2 2 ⍴ 0 1 2 3)
> 
> It does work on Dyalog, and gives the expected result.
> 
> Regards,
> Elias


---
Louis Chrétien
lchret...@mac.com






Re: Disclose fails with mixed ranks

2021-09-22 Thread Blake McBride
What does IBM APL 2 do?

On Wed, Sep 22, 2021 at 10:55 AM Louis Chretien via Bugs and suggestions
for GNU APL  wrote:

> And what is the correct answer?
>
> I tried it with APL/X 5.1, and i get the same “RANK ERROR” as in GNU APL.
>
> If i understand disclose correctly, the right argument are nested
> elements, but of a shape that allows for them to be laminated into a matrix
> as a result. Having a scalar, a vector and a matrix is bound to create
> difficulty.
>
> On Sep 22, 2021, at 09:16, Elias Mårtenson  wrote:
>
> The following expression should work, if I'm reading the ISO spec
> correctly:
>
> ⊃ 3 (1 2) (2 2 ⍴ 0 1 2 3)
>
> It does work on Dyalog, and gives the expected result.
>
> Regards,
> Elias
>
>
>
> ---
> Louis Chrétien
> lchret...@mac.com
>
>
>
>
>


Re: Disclose fails with mixed ranks

2021-09-22 Thread Dr . Jürgen Sauermann

  
  
Hi Elias,
  
  thanks, fixed in SVN 1485.
  
  Best Regards,
  Jürgen
  

On 9/22/21 3:16 PM, Elias Mårtenson
  wrote:


  
  
The following _expression_ should work, if I'm reading the
  ISO spec correctly:


⊃ 3 (1 2) (2 2 ⍴ 0 1 2 3)


It does work on Dyalog, and gives the expected result.


Regards,
Elias

  


  




Re: Disclose fails with mixed ranks

2021-09-22 Thread Louis Chretien via Bugs and suggestions for GNU APL
Strange, because when i tried it in Dyalog 18, the result is only the number 3, 
not the matrix you got.

  display  3 (1 2) (2 2 ⍴ 0 1 2 3)
┌→──┐
│   ┌→──┐ ┌→──┐ │
│ 3 │1 2│ ↓0 1│ │
│   └~──┘ │2 3│ │
│ └~──┘ │
└∊──┘
  display ⊃ 3 (1 2) (2 2 ⍴ 0 1 2 3)
 
3
 

> On Sep 22, 2021, at 12:49, Elias Mårtenson  wrote:
> 
> Well, for each element that has lower rank than the highest-rank element in 
> the list should be rank-extended by prepending 1.
> 
> In other words, in the example I gave, the maximum rank (last element) is 2. 
> The rank-1 element (the second one) should be extended to (1 2) by prepending 
> 1.
> 
> Thus, the result from Dyalog is:
> 
> ┌┌→──┐
> ↓↓3 0│
> ││0 0│
> ││   │
> ││1 2│
> ││0 0│
> ││   │
> ││0 1│
> ││2 3│
> └└~──┘
> 
> The current implementation already extends scalars, so it seems to 
> special-case that case anyway.
> 
> Regards,
> Elias
> 
> On Wed, 22 Sept 2021 at 23:55, Louis Chretien via Bugs and suggestions for 
> GNU APL mailto:bug-apl@gnu.org>> wrote:
> And what is the correct answer?
> 
> I tried it with APL/X 5.1, and i get the same “RANK ERROR” as in GNU APL.
> 
> If i understand disclose correctly, the right argument are nested elements, 
> but of a shape that allows for them to be laminated into a matrix as a 
> result. Having a scalar, a vector and a matrix is bound to create difficulty.
> 
>> On Sep 22, 2021, at 09:16, Elias Mårtenson > > wrote:
>> 
>> The following expression should work, if I'm reading the ISO spec correctly:
>> 
>> ⊃ 3 (1 2) (2 2 ⍴ 0 1 2 3)
>> 
>> It does work on Dyalog, and gives the expected result.
>> 
>> Regards,
>> Elias
> 
> 
> ---
> Louis Chrétien
> lchret...@mac.com 
> 
> 
> 
> 


---
Louis Chrétien
lchret...@mac.com






Re: Disclose fails with mixed ranks

2021-09-22 Thread Elias Mårtenson
Well, for each element that has lower rank than the highest-rank element in
the list should be rank-extended by prepending 1.

In other words, in the example I gave, the maximum rank (last element) is
2. The rank-1 element (the second one) should be extended to (1 2) by
prepending 1.

Thus, the result from Dyalog is:

┌┌→──┐
↓↓3 0│
││0 0│
││   │
││1 2│
││0 0│
││   │
││0 1│
││2 3│
└└~──┘

The current implementation already extends scalars, so it seems to
special-case that case anyway.

Regards,
Elias

On Wed, 22 Sept 2021 at 23:55, Louis Chretien via Bugs and suggestions for
GNU APL  wrote:

> And what is the correct answer?
>
> I tried it with APL/X 5.1, and i get the same “RANK ERROR” as in GNU APL.
>
> If i understand disclose correctly, the right argument are nested
> elements, but of a shape that allows for them to be laminated into a matrix
> as a result. Having a scalar, a vector and a matrix is bound to create
> difficulty.
>
> On Sep 22, 2021, at 09:16, Elias Mårtenson  wrote:
>
> The following expression should work, if I'm reading the ISO spec
> correctly:
>
> ⊃ 3 (1 2) (2 2 ⍴ 0 1 2 3)
>
> It does work on Dyalog, and gives the expected result.
>
> Regards,
> Elias
>
>
>
> ---
> Louis Chrétien
> lchret...@mac.com
>
>
>
>
>


Re: Disclose fails with mixed ranks

2021-09-22 Thread Louis Chretien via Bugs and suggestions for GNU APL
In Dyalog, did u change the Quad ML setting?

Because this is definitely not the result i am getting

> On Sep 22, 2021, at 12:49, Elias Mårtenson  wrote:
> 
> Well, for each element that has lower rank than the highest-rank element in 
> the list should be rank-extended by prepending 1.
> 
> In other words, in the example I gave, the maximum rank (last element) is 2. 
> The rank-1 element (the second one) should be extended to (1 2) by prepending 
> 1.
> 
> Thus, the result from Dyalog is:
> 
> ┌┌→──┐
> ↓↓3 0│
> ││0 0│
> ││   │
> ││1 2│
> ││0 0│
> ││   │
> ││0 1│
> ││2 3│
> └└~──┘
> 
> The current implementation already extends scalars, so it seems to 
> special-case that case anyway.
> 
> Regards,
> Elias
> 
> On Wed, 22 Sept 2021 at 23:55, Louis Chretien via Bugs and suggestions for 
> GNU APL mailto:bug-apl@gnu.org>> wrote:
> And what is the correct answer?
> 
> I tried it with APL/X 5.1, and i get the same “RANK ERROR” as in GNU APL.
> 
> If i understand disclose correctly, the right argument are nested elements, 
> but of a shape that allows for them to be laminated into a matrix as a 
> result. Having a scalar, a vector and a matrix is bound to create difficulty.
> 
>> On Sep 22, 2021, at 09:16, Elias Mårtenson > > wrote:
>> 
>> The following expression should work, if I'm reading the ISO spec correctly:
>> 
>> ⊃ 3 (1 2) (2 2 ⍴ 0 1 2 3)
>> 
>> It does work on Dyalog, and gives the expected result.
>> 
>> Regards,
>> Elias
> 
> 
> ---
> Louis Chrétien
> lchret...@mac.com 
> 
> 
> 
> 


---
Louis Chrétien
lchret...@mac.com






Re: Disclose fails with mixed ranks

2021-09-22 Thread Roland Besserer
  Very interesting.The APLX manual is quite explicit in that all element of the right argument must be of the same rank or a scalar. So the rank error makes sense.Dialog, as usual, doesn't fail to surprise.At ML 1 Disclose behaves like Pick and at levels 2 and 3 it extends rank, not just shape as APLX does. Sent from my BlackBerry - the most secure mobile device   From: bug-apl@gnu.orgSent: September 22, 2021 12:47To: bug-apl@gnu.orgReply-to: lchret...@me.comSubject: Re: Disclose fails with mixed ranks  In Dyalog, did u change the Quad ML setting?Because this is definitely not the result i am gettingOn Sep 22, 2021, at 12:49, Elias Mårtenson  wrote:Well, for each element that has lower rank than the highest-rank element in the list should be rank-extended by prepending 1.In other words, in the example I gave, the maximum rank (last element) is 2. The rank-1 element (the second one) should be extended to (1 2) by prepending 1.Thus, the result from Dyalog is:┌┌→──┐↓↓3 0│││0 0│││   │││1 2│││0 0│││   │││0 1│││2 3│└└~──┘The current implementation already extends scalars, so it seems to special-case that case anyway.Regards,EliasOn Wed, 22 Sept 2021 at 23:55, Louis Chretien via Bugs and suggestions for GNU APL  wrote:And what is the correct answer?I tried it with APL/X 5.1, and i get the same “RANK ERROR” as in GNU APL.If i understand disclose correctly, the right argument are nested elements, but of a shape that allows for them to be laminated into a matrix as a result. Having a scalar, a vector and a matrix is bound to create difficulty.On Sep 22, 2021, at 09:16, Elias Mårtenson  wrote:The following _expression_ should work, if I'm reading the ISO spec correctly:⊃ 3 (1 2) (2 2 ⍴ 0 1 2 3)It does work on Dyalog, and gives the expected result.Regards,Elias

---Louis Chrétienlchret...@mac.com




---Louis Chrétienlchret...@mac.com