Thanks for mentioning this. I wonder if it should go in the top post. I have been working through the ‘Zark tutorial’ on the Dyalog website, I didn’t know about this course until I saw your post.
I just finished Phase 1! Some of my solutions were terrible. Others turned out quite nice. When the submission deadline has passed I will create a new thread to discuss the problems.
Well done! Are you going to enter Phase 2 of the competition? I am stuck at the moment and researching how to do loop in a loopless language. Can you recommend some beginner-friendly resources to me?
I hope Adám Brudzewsky doesn’t see this
![]()
On average, it took 2 months to break an old habit. I am on Day 18 (or 11 APL sessions). So, I have not yet adapted array-oriented thinking. ![]()
Well you’re way ahead of me because I’m still doing the “Zark tutorial” (not quite at the level of doing the competition yet) ![]()
When I learnt Python, I followed various books/tutorials. But, when I put it into practice, I hardly write a simple function. So, I am trying to practice APL as soon as possible.
BTW, I found a “FizzBuzz” written in APL. It is eye-opening ![]()

I guess that’s kinda what each is?..
Staying with dfns, your choices are using the Power operator ⍣ or recursion; a dfn can call itself using ∇ so it doesn’t need to know its own name (or even have one).
That said, there’s an another function syntax (actually the original one of APL) which does feature a full set of control structures.
I am not going to attempt Phase 2. I had fun working on Phase 1 but it took more time than expected. I learned a ton though! I don’t have any recommendations for learning resources as I am still exploring myself. I did see that @abrudz has an excellent YouTube series called APL Quest where he reviews problems from Phase 1 of past APL Problem Solving Competitions. There is an associated APL Quest Wiki which has more information.
I think a good learning strategy for myself would be to try out a problem each week and follow up by watching the video to see how others solved it.
The tutorial is wonderful! @mike.moloch Thanks!
Have a look at the cultivation dedicated to array programming techniques which looks at an alternative approach to FizzBuzz.
@abrudz When a function is simple, I can use ⍵ to assign value to ⍺.

However, when a function involves multiple operations and logic, I got VALUE ERROR or SYNAX ERROR. What is the best practice to handle this type of situation?

When you assign to ⍺, you give it a default value in case no left argument is given; you make the function ambivalent: it can be called both monadically and dyadically. If this is what you intended in your first example, you can see what happens if you call your function X with a left argument.
X←{⍺←⍵+2⋄(2×⍺)+⍳⍵}
X 3
11 12 13
10 X 3
21 22 23
In your function f below, it’s hard to say without also seeing how you called it – the ⍺ your arrow is pointing to is a different ⍺ than the one given to f (as your redacted bit is an inner anonymous function). If you can show the redacted bit, it’s easier to tell what’s happening. It’s possible that you intended the inner ⍺ to be the ⍵+2 of the outer function, but that won’t work – give it another name if that’s what you intended. If I had to guess, you didn’t give the inner function a left argument:
f←{⍺←⍵+2⋄⍺{5≤⍵+⍳⍺}¨⍳⍵}
f 5
0 0 0 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
but this is an error:
f←{⍺←⍵+2⋄{5≤⍵+⍳⍺}¨⍳⍵}
f 5
VALUE ERROR
In general though, don’t assign to ⍺ unless you really need your function to be ambivalent.
Redaction is probably due to it being a competition solution.
When using a variable name (not ⍺, ⍺⍺ or ⍵⍵), the long function works perfectly. Thank you! ![]()
