Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-05-06 Thread Louis de Forcrand
Sorry for answering so late. I'm basing everything I say on rank as it's interpreted in J. The rank of an array is the number of dimensions it has. A scalar has rank 0, a vector 1, matrix 2, cube 3, etc. If an array has the shape 3 1 4 1 5 9, then it can be "decomposed" into a frame and cells: it

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-05-06 Thread Alexey Veretennikov
Actually Dyalog returns the same result. Elias Mårtenson writes: > In GNU APL, the following two expressions yield the same result: > > (+/⍤1) 3 4⍴⍳100 > ┏→━━━┓ > ┃10 26 42┃ > ┗┛ > > And: > > (+/⍤¯1) 3 4⍴⍳100 > ┏→━━━┓ > ┃10 26 42┃ > ┗┛ > > I would expect the latter to yie

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-05-06 Thread Ala'a Mohammad
TryAPL is powered by Dyalog APL and shows the same results as GNU APL on the neg one case, as below: http://tryapl.org/#?a=%28+/%u2364%AF1%293%204%u2374%u2373100&run Ala'a

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-05-06 Thread Juergen Sauermann
Hi Elias, the ISO standard (taking the monadic case for simplicity) says: Z ← f  ⍣ y B ... If y is a scalar, set y1 to ,y. Otherwise set y1 to y. If y1 is not a vector, signal domain-error. If y1 has more than three elements, signal lengt

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-05-06 Thread Elias Mårtenson
In GNU APL, the following two expressions yield the same result: * (+/⍤1) 3 4⍴⍳100* ┏→━━━┓ ┃10 26 42┃ ┗┛ And: * (+/⍤¯1) 3 4⍴⍳100* ┏→━━━┓ ┃10 26 42┃ ┗┛ I would expect the latter to yield the following (which is what I believe Dyalog does): ┏→━━┓ ┃15 18

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-05-06 Thread Jay Foad
On 6 May 2016 at 13:52, Juergen Sauermann wrote: > Except maybe for the Dyalog ¯1 case (primarily because I don't know what > "major cells" are). Dyalog treats ¯1 the same as the ISO standard (and therefore also GNU APL). "Major cell" is explained on page 14 of: http://docs.dyalog.com/14.1/Dyalog

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-05-06 Thread Juergen Sauermann
Hi, after reading both the ISO standard and the Dyalog definition of ⍤ several times, it seems to me as if they all describe the same thing (in different ways). Except maybe for the Dyalog ¯1 case (primarily because I don't know what "major cells" are).

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-05-02 Thread Alexey Veretennikov
Hi, Here is the definition http://help.dyalog.com/14.1/Content/Language/Primitive%20Operators/Rank.htm Juergen Sauermann writes: > Hi Louis, > > just for curiosity, where are negative ranks defined? > My version of "Mastering Dyalog APL" (ISBN : 978-0-9564638-0-7) does > not even mention the ra

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-05-02 Thread Juergen Sauermann
Hi Louis, just for curiosity, where are negative ranks defined? My version of "Mastering Dyalog APL" (ISBN : 978-0-9564638-0-7) does not even mention the rank operator. /// Jürgen On 04/28/2016 12:31 AM, Louis de Fo

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-04-27 Thread Louis de Forcrand
Whoops. Looks like I got here too late. Well done! Louis > On 28 Apr 2016, at 00:29, Louis de Forcrand wrote: > > The three-item form is used if the associated function is ambivalent (applied > to the P-cells of ⍵ if monadic, applied to corresponding Q-cells of ⍺ and > R-cells of ⍵ if dyadic)

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-04-27 Thread Louis de Forcrand
The three-item form is used if the associated function is ambivalent (applied to the P-cells of ⍵ if monadic, applied to corresponding Q-cells of ⍺ and R-cells of ⍵ if dyadic). I don't believe it is possible to define ambivalent functions in ISO APL however, so it is kind of redundant. It is pro

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-04-27 Thread Jay Foad
Incidentally, it works like this in Dyalog and NARS2000 too, though the Dyalog documentation doesn't mention the 3-item form. Jay. On 27 April 2016 at 09:02, Jay Foad wrote: > Given g ← f⍤P Q R: > P is the monadic rank > Q is the left rank > R is the right rank > > So: > g Y applies g to the P-c

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-04-27 Thread Elias Mårtenson
Thanks, that's interesting. However, I'm still a big confused about the 3-value case. When is P, Q and R all used? Secondly, do you agree that that negative ranks would be useful? Regards, Elias On 27 April 2016 at 16:02, Jay Foad wrote: > You're reading section 9.3.4 "Rank operator deriving

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-04-27 Thread Jay Foad
You're reading section 9.3.4 "Rank operator deriving monadic function". You also need to look at 9.3.5 "Rank operator deriving dyadic function". Given g ← f⍤P Q R: P is the monadic rank Q is the left rank R is the right rank So: g Y applies g to the P-cells of Y X g Y applies g to the Q-cells of