Re: [Bug-apl] IOTA

2016-03-06 Thread Juergen Sauermann
Hi Mike, I see. What is important  for GNU APL is compatibility with IBM APL2, whatever the reason might have been. I could also imagine that enclosing a simple scalar would give a nested simple scalar, that would also satisfy the conditi

Re: [Bug-apl] IOTA

2016-03-06 Thread Mike Duvos
Hi Jürgen, When James A. Brown wrote APL2, he based his arrays on Trenchard More's "Array Theory", an attempt to give nested rectangular arrays an axiomatic foundation equivalent to that of set theory. The major implementation of this idea is in the language NIAL, of which Q'NIAL is a popular inc

Re: [Bug-apl] IOTA

2016-03-03 Thread Juergen Sauermann
Hi Elias, yes, thanks. SVN 700. /// Jürgen On 03/03/2016 02:41 PM, Elias Mårtenson wrote: The original question is as of yet unresolved though. Wouldn't it make sense to extend GNU APL's iota function

Re: [Bug-apl] IOTA

2016-03-03 Thread Juergen Sauermann
Hi Mike, I probably did not get it back in September. To me it is not quite obvious why enclosing a nested scalar is different from enclosing a simple scalar. But since ISO and APL2 agree in this regard, I should follow suit. /// Jürgen

Re: [Bug-apl] IOTA

2016-03-03 Thread Mike Duvos
Hi Jürgen, I commented on this enclose issue back on the 14th of September. I actually liked the way GNU APL did it. https://lists.gnu.org/archive/html/bug-apl/2015-09/msg00061.html Regards, Mike

Re: [Bug-apl] IOTA

2016-03-03 Thread Ala'a Mohammad
Hi, I'm playing with this definition and noticed that if the argument was scalar (if the term is correct) and more than 2 then it returns strange result i 1 ┌─┐ │1│ └─┘ i 2 ┌2──┐ │1 2│ └───┘ i 3 ┌2──┐ │┌2──┐ ┌2──┐│ ││1 2│ │1 3││ │└───┘ └───┘│ └∊──┘ i 4 ┌2──

Re: [Bug-apl] IOTA

2016-03-03 Thread Juergen Sauermann
Hi, I have changed GNU APL so that B ≡ ⊂B if and only if B is a simple scalar. Before the change B ≡ ⊂B also for non-simple scalar B. Unfortunately Elias' correct observation that (⊂⊂B) ≡ ⊂B in GNU APL was almost an axiom in GNU APL

Re: [Bug-apl] IOTA

2016-03-03 Thread Elias Mårtenson
The original question is as of yet unresolved though. Wouldn't it make sense to extend GNU APL's iota function to do the same as Dyalog? It wouldn't cause any compatibility issues since it raises an error right now. Regards, Elias On 3 March 2016 at 20:26, Juergen Sauermann wrote: > Hi, > > I s

Re: [Bug-apl] IOTA

2016-03-03 Thread Juergen Sauermann
Hi, I see. I guess I overlooked the 'simple' attribute in both definitions. I will fix this in GNU APL. /// Jürgen On 03/03/2016 12:53 PM, Kacper Gutowski wrote: On Thu, Mar 3, 2016 at 12:40

Re: [Bug-apl] IOTA

2016-03-03 Thread Kacper Gutowski
On Thu, Mar 3, 2016 at 12:40 PM, Juergen Sauermann wrote: > the IBM APL2 language reference says (page 111): > > If R is a simple scalar, ⊂ R is R. If R is not a simple scalar, the depth of > R is 1+ ≡R. > > And the ISO standard says the same (page 169): > > Z ← ⊂B > Note: If B is a simple-scalar

Re: [Bug-apl] IOTA

2016-03-03 Thread Jay Foad
On 3 March 2016 at 11:40, Juergen Sauermann wrote: > Therefore I believe Elias' statement > > My understanding was that (⊂⊂x)≡⊂x for all x? > > is correct as far as ISO, IBM APL2, and GNU APL are concerned. It is clearly not true in APL2! x←1 2 3 (⊂⊂x)≡⊂x 0 (Same result in NARS2000

Re: [Bug-apl] IOTA

2016-03-03 Thread Juergen Sauermann
Hi, the IBM APL2 language reference says (page 111): If R is a simple scalar, ⊂R is R. If R is not a simple scalar, the depth of R is 1+ ≡R. And the ISO standard says the same (page 169): Z ← ⊂B  Note: If B is a simple-s

Re: [Bug-apl] IOTA

2016-03-03 Thread Jay Foad
On 3 March 2016 at 08:12, Elias Mårtenson wrote: > What is the purpose of the double-enclose ⊂⊂⍬ ? > > My understanding was that (⊂⊂x)≡⊂x for all x? No! ⊂ is a no-op on simple scalars like 42, but not on enclosures like ⊂⍬. You can enclose most arrays (i.e. anything except simple scalars) as many

Re: [Bug-apl] IOTA

2016-03-03 Thread Elias Mårtenson
What is the purpose of the double-enclose ⊂⊂⍬ ? My understanding was that (⊂⊂x)≡⊂x for all x? Regards, Elias On 3 March 2016 at 16:05, Jay Foad wrote: > Right. Here's a variation on Elias's solution that gets IOTA ⍬ right, > but doesn't handle the singleton cases correctly! > > IOTA ← {⊃∘.,/(⍳

Re: [Bug-apl] IOTA

2016-03-03 Thread Jay Foad
Right. Here's a variation on Elias's solution that gets IOTA ⍬ right, but doesn't handle the singleton cases correctly! IOTA ← {⊃∘.,/(⍳¨⍵),⊂⊂⍬} On 3 March 2016 at 01:08, Nick Lobachevsky wrote: > There is at least one other degenerate case, namely the "legacy" > singleton, or one element vector.

Re: [Bug-apl] IOTA

2016-03-02 Thread Nick Lobachevsky
There is at least one other degenerate case, namely the "legacy" singleton, or one element vector. With a scalar argument, monadic iota returns a result depth one. With a vector argument, iota returns a result depth two. Except when there is only one element. ≡⍳⍳0 ⍝ can't find zilde 2

Re: [Bug-apl] IOTA

2016-03-02 Thread Elias Mårtenson
Not easily. That said, I'm not sure I agree that the should give a DOMAIN ERROR: * ∘.+/ ⍬* DOMAIN ERROR ∘.+/⍬ ^ ^ Regards, Elias On 2 March 2016 at 17:38, Jay Foad wrote: > Cool! For bonus marks can you make it work in the degenerate case: > > ⍳⍬ ←→ ⊂⍬ > > ? > > Jay. > > O

Re: [Bug-apl] IOTA

2016-03-02 Thread Jay Foad
Cool! For bonus marks can you make it work in the degenerate case: ⍳⍬ ←→ ⊂⍬ ? Jay. On 2 March 2016 at 02:23, Elias Mårtenson wrote: > Looking at it further, I realise you need do disclose the result in order to > make them equivalent: > > IOTA ← {⊃∘.,/⍳¨⍵} > > Regards, > Elias > > On 2

Re: [Bug-apl] IOTA

2016-03-01 Thread Christian Robert
thank you very much, I now understand how it work ! looks so easy for you ;-) and so hard for me :-( Xtian. On 2016-03-01 21:43, Elias Mårtenson wrote: On 2 March 2016 at 10:28, Christian Robert mailto:christian.rob...@polymtl.ca>> wrote: IOTA ← {∘.,/⍳¨⍵} yes, it does the trick (you

Re: [Bug-apl] IOTA

2016-03-01 Thread Elias Mårtenson
On 2 March 2016 at 10:28, Christian Robert wrote: > IOTA ← {∘.,/⍳¨⍵} > > yes, it does the trick (you are really good btw) > I don't consider myself good. :-) Anyway, it's quite simple. Let me break it down: First of all, ¨⍳⍵ will simply create the individual iotas: * ⍳¨2 3 4* ┌→

Re: [Bug-apl] IOTA

2016-03-01 Thread Christian Robert
I see, but what is the "/" doing ? Xtian {⍳¨⍵} 1 ┌───┐ │┌→┐│ ││1││ │└─┘│ └∊──┘ {⍳¨⍵} 1 2 ┌2┐ │┌→┐ ┌2──┐│ ││1│ │1 2││ │└─┘ └───┘│ └∊┘ {⍳¨⍵} 1 2 3 ┌3┐ │┌→┐ ┌2──┐ ┌3┐│ ││1│ │1 2│ │1 2 3││ │└─┘ └───┘ └─┘│ └∊┘ {∘.,/⍳¨⍵} 1

Re: [Bug-apl] IOTA

2016-03-01 Thread Christian Robert
IOTA ← {∘.,/⍳¨⍵} yes, it does the trick (you are really good btw) but I had to disclose the result IOTA 2 3 5 ┌─┐ │┌5──┐│ │2┌3┐ ┌3┐ ┌3┐ ┌3┐ ┌3┐││ │││1 1 1│ │1 1 2│ │1 1 3│ │1 1 4│ │1 1 5│││ │3└

Re: [Bug-apl] IOTA

2016-03-01 Thread Elias Mårtenson
Looking at it further, I realise you need do disclose the result in order to make them equivalent: * IOTA ← {⊃∘.,/⍳¨⍵}* Regards, Elias On 2 March 2016 at 10:19, Elias Mårtenson wrote: > I don't know about a loop, but wouldn't this do the same thing? > > *IOTA ← {∘.,/⍳¨⍵}* > > Regards,

Re: [Bug-apl] IOTA

2016-03-01 Thread Elias Mårtenson
I don't know about a loop, but wouldn't this do the same thing? *IOTA ← {∘.,/⍳¨⍵}* Regards, Elias On 2 March 2016 at 09:57, Christian Robert wrote: > I have this function, > > ∇IOTA[⎕]∇ > ∇ > [0] z←IOTA v > [1] z←⍳↑v > [2] v←1↓,v > [3] Loop: →(0=⍴v)/0 > [4] z←z∘.,⍳↑v > [