Unfortunately, and for historical reasons, the slash symbol family (/⌿\⍀) are functions when they have an array to their left, but operators when they have a function to their left. They prefer to be operators.
@KritixiLithos Right. Consider the dfn {⍺/⍵}. You may think that it is equivalent to the train (⊣/⊢) but the / will bind to ⊣ first, so you get ((⊣/)⊢) which is of course the same as the dfn {⊣/⍵}.
é←{⍺/⍵}
É←{⍺⌿⍵}
è←{⍺\⍵}
È←{⍺⍀⍵}
@KritixiLithos ^ Is fairly mnemonic, and I hope we will get new symbols for these soon anyways, so we can put the past behind us.
Just be aware that the letters of course need a separator from immediately following numeric constants or names.
@KritixiLithos And beware here. The shortest solution I came up with for problem 6 is not what I will judge as the best solution when the time comes to judge the student competition entries.
@KritixiLithos Compare to non array oriented languages (scalar languages?), APLs generally need no or very little special notation for looping, mapping, and folding.
FOR item IN items DO result.append(function(item)) ENDFOR ←→ function items
FOR a b INEACH list1 list2 DO result.append(function (a,b)) ENDFOR ←→ list1 function list2
FOR item IN items DO result+=item ENDFOR ←→ +/items
@KritixiLithos Exactly. The first is recursive, and keeps recalculating the values from 1-n for every n in the range 1-N. The second just loops and appends another value.
@KritixiLithos Also, the first is mashed together, the second has spaces around ⋄.
And for phase II, I'd want something like this:
fibII←{ ⍝ Fibonacci series 1 1 ... (N terms)
{
⍬≡⍵:⍬ ⍝ initial value
⍵,+/¯2↑⍵ ⍝ append new value
}⍣(⍵-1)⊢1 ⍝ repeat
}
@KritixiLithos More things: Using APL's build-in looping scores higher than using explicit loops. This is mentioned in the sample problem text for phase I.
@KritixiLithos :For ranks lower than ¨ which in turn ranks lower than just using scalar functions on higher rank arrays.
E.g.:
r←a xProd1 b;an;bn
r←0
:For an bn :InEach a b
r+←an×bn
:EndFor
r←a xProd2 b
r←0
a{r+←⍺×⍵}¨b
r←a xProd3 b
r←a+.×b
Here, of course, the successive solutions get shorter too. But that isn't the point here.
Oh, and of course, the best solution would be xProd4←+.×
@KritixiLithos Also, attention to detail: Last year, IIRC, none of the participants fulfilled all the specs of all phase I questions. Read them like you do challenges on PPCG!