« first day (103 days earlier)      last day (2550 days later) » 

7:01 AM
@ngn I cloned your vim-apl into my .vim/bundle/, but it doesn't seem to work. I get no syntax highlighting
Even after doing :set syntax=apl on an APL file, I get no highlighting
 
 
3 hours later…
10:00 AM
@KritixiLithos I'll explain it here.
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.
 
Ah, I understand. The é just mimics the function version of /
 
@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.
 
10:24 AM
For some reason, I'm getting a DOMAIN ERROR when trying to load a .dyalog file of mine
 
@KritixiLithos Well, are you positive that the file is well-formed?
 
Loading the file used to work
but not today, apparently
 
@KritixiLithos How do you load it?
 
]load /path/to/file
 
@KritixiLithos Can you paste the file in here?
 
10:35 AM
SPOILER ALERT: I found the bad line: Problem6←{⍺,/⍵}
 
@KritixiLithos That actually isn't a correct solution to number 6.
 
I see
 
@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.
 
 
3 hours later…
1:22 PM
Then what would you say would classify as "array oriented programming"?
 
1:34 PM
@KritixiLithos Handling entire structures as self-contained items.
 
so what does that exactly mean?
 
@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
 
1:55 PM
@KritixiLithos Makes any sense?
 
 
3 hours later…
4:35 PM
@Adám Could you give a simple example in APL where one solution would be better than the other while still having more bytes?
 
4:46 PM
@KritixiLithos Do you mean regarding algorithm, or coding style?
 
Better as is which one would rank higher in the student competition
 
@KritixiLithos OK, here is an example. Task: Given N, find the first N terms of the Fibonacci series, beginning with 1 1
fib1←{1≥⍵:1⋄+/∇¨⍵-1 2}¨⍳
fib2←{{⍬≡⍵:⍬ ⋄ ⍵,+/¯2↑⍵}⍣(⍵-1)⊢1}
fib2 is much better than fib1.
(This doesn't mean that any of them is good. This is just for illustration.)
Oops, should be 2≥ in fib1.
@KritixiLithos Try it online!
 
5:08 PM
So the efficiency is also counted
 
@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.
 
@Adám By builtin-in vs explicit, do you mean :For, :While vs ¨?
 
@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!
 
5:28 PM
Oh yeah, PPCG gives some really good practice.
 

« first day (103 days earlier)      last day (2550 days later) »