LocalStorage disabled or you are using an old browser. We try out best to deal with it, but you will need to register (and log in) to have your solutions saved.

APL Problem Solving Competition
Phase I

The following shows what a typical Phase I problem description looks like. It also presents some possible solutions of varying quality, and explains how to provide your own solution. Content that doesn't appear in regular Phase I problems is formatted like this paragraph.

Each problem begins with a task description, followed by a hint suggesting one or more APL primitives. These may be helpful in solving the problem, but you are under no obligation to use them. Clicking on a primitive in the hint will open the Dyalog documentation page for the suggested primitive.

After the hint is a section of example cases which, among others, are included in the automated tests. Use these as a basis for implementing your solution.

Sample: Counting Vowels

Write an APL function to count the number of vowels (A, E, I, O, U) in an array consisting of uppercase letters (A–Z).

Hint: The membership function X∊Y could be helpful for this problem.


      (your_functionfn) 'COOLAPL'
      (your_functionfn) ''   ⍝ empty argument
      (your_functionfn) 'NVWLSHR'   ⍝ no vowels here

Below are three sample solutions. All three produce the correct answer, but the first two functions would be ranked higher by the competition judging committee. This is because the first two demonstrate better use of array-oriented programming.

      ({+/⍵∊'AEIOU'}) 'COOLAPL'   ⍝ good dfn
      (+/∊∘'AEIOU') 'COOLAPL'   ⍝ good tacit function
      ⍝ suboptimal dfn:
      {(+/⍵='A')+(+/⍵='E')+(+/⍵='I')+(+/⍵='O')+(+/⍵='U')} 'COOLAPL'   ⍝ suboptimal dfn

Developing a solution/Using the language bar

You can develop your solution using an installed APL system or online using TryAPL and when ready to test it, paste it into the input field labelled your_functionfn, at the bottom of the page. However, you can type a solution directly using either an installed APL keyboard, or by clicking on the appropriate symbols in the language bar ←   + - × ÷ * ⍟ ○ ! ? found directly above the input field. Hovering over a symbol on the language bar will display:

  • The APL symbol.
  • The common names for the concepts that the symbol represents.
  • The symbol's "Tab" input method: Enter two symbols which resemble the APL symbol when overlaid, then press Tab  to combine them. For example, <-Tab  yields the symbol.
  • The symbol's "Backtick" input method: Press any one of the prefix keys `, §, °, ², µ, º, ½ or ù, and then the key according to the diagram here.

Enter your function (without any arguments) into the input field labelled your_functionfn and then hit  Test or   Enter.

  • The system will apply your function on a variety of test arguments.
  • You'll receive a silver trophy ( ) if your function passes all the basic tests.
  • If your solution passes all the basic tests and all the edge cases, you'll receive the highly prestigious and coveted gold trophy with a star ( ).
  • If your solution fails on one or more basic or edge test cases, the system will give an example of arguments that failed.

Submitting your solution

When you're happy with your solution, hit  Submit. You must be logged in to submit. The system will allow you to submit only solutions which at least pass all of the basic test cases. If you want to improve a solution you've previously submitted, you can come back and change your solution but you can only submit valid solutions.

Try it out!

If you were to put any of the above functions above in the your_functionfn input field and hit  Test or   Enter, you'll see that they receive a silver trophy ( ). This is because none of those functions handle arrays with 2 or more dimensions. The system will also give you an example of a multi-dimensional edge case that failed, so you can attempt to improve your solution.

Try entering {+/,⍵∊'AEIOU'} which handles all test cases and gives you a gold trophy with a star ( ). Note that this sample problem does not affect your results so you can safely leave this page in any state.

2020 Phase I Problem Set

your_function ←fn ←

1: Let's Split!

Write a function that, given a right argument Y which is a scalar or a non-empty vector and a left argument X which is a single non-zero integer so that its absolute value is less or equal to ≢Y, splits Y into a vector of two vectors according to X, as follows:

  • If X>0, the first vector contains the first X elements of Y and the second vector contains the remaining elements.
  • If X<0, the second vector contains the last |X elements of Y and the first vector contains the remaining elements.
  • Hint: The Take function X↑Y might be useful for this problem.


          9 (your_functionfn) 'SplittingHairs'   ⍝ using ]Boxing on
          ¯3 (your_functionfn) 'DyalogAPL'
          10 (your_functionfn) ⍳10
    │1 2 3 4 5 6 7 8 9 10││
          1 (your_functionfn) 'works' 'with' 'words' 'also'
    your_function ←fn ←

    2: Character Building

    UTF-8 encodes Unicode characters using 1-4 integers for each character. Dyalog APL includes a system function, ⎕UCS, that can convert characters into integers and integers into characters. The expression 'UTF-8'∘⎕UCS converts between characters and UTF-8.

    Consider the following:

          'UTF-8'∘⎕UCS 'D¥⍺⌊○9'
    68 194 165 226 141 186 226 140 138 226 151 139 57
          'UTF-8'∘⎕UCS 68 194 165 226 141 186 226 140 138 226 151 139 57

    How many integers does each character use?

          'UTF-8'∘⎕UCS¨ 'D¥⍺⌊○9' ⍝ using ]Boxing on
    │68│194 165│226 141 186│226 140 138│226 151 139│57│

    The rule is that an integer in the range 128 to 191 (inclusive) continues the character of the previous integer (which may itself be a continuation). With that in mind, write a function that, given a right argument which is a simple integer vector representing valid UTF-8 text, encloses each sequence of integers that represent a single character, like the result of 'UTF-8'∘⎕UCS¨'UTF-8'∘⎕UCS but does not use any system functions (names beginning with )

    Hint: Use ⎕UCS to verify your solution.


          (your_functionfn) 68 194 165 226 141 186 226 140 138 240 159 148 178 57   ⍝ using ]Boxing on
    │68│194 165│226 141 186│226 140 138│240 159 148 178│57│
          (your_functionfn) 68 121 97 108 111 103   ⍝ 'Dyalog'
          (your_functionfn) ⍬   ⍝ '' (any empty vector result is acceptable here)
    your_function ←fn ←

    3: Excel-lent Columns

    A Microsoft Excel spreadsheet numbers its rows counting up from 1. However Excel's columns are labelled alphabetically — beginning with A–Z, then AA–AZ, BA–BZ, up to ZA–ZZ, then AAA–AAZ and so on.

    Write a function that, given a right argument which is a character scalar or non-empty vector representing a valid character Excel column identifier between A and XFD, returns the corresponding column number

    Hint: The Decode function X⊥Y.


          (your_functionfn) 'A'
          (your_functionfn) 'APL'
    your_function ←fn ←

    4: Take a Leap

    Write a function that, given a right argument which is an integer array of year numbers greater than or equal to 1752 and less than 4000, returns a result of the same shape as the right argument where 1 indicates that the corresponding year is a leap year (0 otherwise).

    A leap year algorithm can be found here.

    Hint: The Residue function X|Y and the Outer Product operator ∘. could be useful for this problem.


          (your_functionfn) 2020
          (your_functionfn) ⍬   ⍝ returns an empty vector
          (your_functionfn) 1900+10 10⍴⍳100
    0 0 0 1 0 0 0 1 0 0
    0 1 0 0 0 1 0 0 0 1
    0 0 0 1 0 0 0 1 0 0
    0 1 0 0 0 1 0 0 0 1
    0 0 0 1 0 0 0 1 0 0
    0 1 0 0 0 1 0 0 0 1
    0 0 0 1 0 0 0 1 0 0
    0 1 0 0 0 1 0 0 0 1
    0 0 0 1 0 0 0 1 0 0
    0 1 0 0 0 1 0 0 0 1
    your_function ←fn ←

    5: Stepping in the Proper Direction

    Write a function that, given a right argument of 2 integers, returns a vector of the integers from the first element of the right argument to the second, inclusively.

    Hint: The Index Generator function ⍳Y function could be useful when solving this problem.


          (your_functionfn) 3 10
    3 4 5 6 7 8 9 10
          (your_functionfn) 4 ¯3
    4 3 2 1 0 ¯1 ¯2 ¯3
          ⎕←r←(your_functionfn) 42 42
          ⍴r   ⍝ this is also a vector
    your_function ←fn ←

    6: Please Move to the Front

    Write a function that, given a right argument which is an integer vector and a left argument which is an integer scalar, reorders the right argument so any elements equal to the left argument come first while all other elements keep their order.

    Hint: The Grade Up function ⍋Y could be helpful for this problem.


          3 (your_functionfn) 1 2 3 4 1 3 1 4 5
    3 3 1 2 4 1 1 4 5
          3 (your_functionfn) ,1   ⍝ the , makes 1 into a vector
          42 (your_functionfn) ⍬   ⍝ empty right argument gives empty result
    your_function ←fn ←

    7: See You in a Bit

    A common technique for encoding a set of on/off states is to use a value of 2n for the state in position n (origin 0), 1 if the state is "on" or 0 for "off" and then add the values. Dyalog APL's component file permission codes are an example of this. For example, if you wanted to grant permissions for read (access code 1), append (access code 8) and rename (access code 128) then the resulting code would be 137 because that's 1 + 8 + 128.

    Write a function that, given a non-negative right argument which is an integer scalar representing the encoded state and a left argument which is an integer scalar representing the encoded state settings that you want to query, returns 1 if all of the codes in the left argument are found in the right argument (0 otherwise).

    Hint: The Decode function X⊥Y and the derived Inverse operator ⍣¯1 could be helpful for decoding the states.


          2 (your_functionfn) 7   ⍝ is 2 in 7 (1+2+4)?
          4 (your_functionfn) 11   ⍝ is 4 in 11 (1+2+8)?
          3 (your_functionfn) 11   ⍝ is 3 (1+2) in 11 (1+2+8)?
          4 (your_functionfn) 0   ⍝ is 4 in 0?
    your_function ←fn ←

    8: Zigzag Numbers

    A zigzag number is an integer in which the difference in magnitude of each pair of consecutive digits alternates from positive to negative or negative to positive.

    Write a function that takes a single integer greater than or equal to 100 and less than 1015 as its right argument and returns a 1 if the integer is a zigzag number, 0 otherwise.

    Hint: Your solution might make use of N-wise Reduction X f/ Y.


          (your_functionfn) 123 
          (your_functionfn) 132
          (your_functionfn) 31115
          (your_functionfn) 3141514131415
    your_function ←fn ←

    9: Rise and Fall

    Write a function that, given a right argument which is an integer scalar or vector, returns a 1 if the values of the right argument conform to the following pattern (0 otherwise):

    • The elements increase or stay the same until the "apex" (highest value) is reached
    • After the apex, any remaining values decrease or remain the same

    Hint: The Reverse function ⌽Y and the Maximum function X⌈Y combined with N-wise Reduction X f/ Y or Scan f\ Y can help with solving this problem.


          (your_functionfn) 1 3 3 4 5 2 1
          (your_functionfn) 42
          (your_functionfn) 1 3 2 4
          (your_functionfn) 23 23 23 
          (your_functionfn) ⍬  ⍝ empty vector
    your_function ←fn ←

    10: Stacking It Up

    Write a function that takes as its right argument a vector of simple arrays of rank 2 or less (scalar, vector, or matrix). Each simple array will consist of either non-negative integers or printable ASCII characters. The function must return a simple character array that displays identically to what {⎕←⍵}¨ displays when applied to the right argument.

    Hint: The Mix ↑Y, Split ↓Y, and Format ⍕Y functions could be helpful for solving this problem.


    All results will look identical with ]Boxing on as they are simple (non-nested) character arrays.

          (your_functionfn) 'Hi' 'Earth'
          (your_functionfn) (3 3⍴⍳9)(↑'Adam' 'Michael')(⍳10) '*'(5 5⍴⍳25)
    1 2 3               
    4 5 6               
    7 8 9               
    1 2 3 4 5 6 7 8 9 10
     1  2  3  4  5      
     6  7  8  9 10      
    11 12 13 14 15      
    16 17 18 19 20      
    21 22 23 24 25
          (your_functionfn) 'O' 'my!'
          (your_functionfn) ,⊂⍳4
    1 2 3 4
          (your_functionfn) ,'A'
    your_function ←fn ←

    Phase I: Submissions

    These are the solutions you have submitted. If you've solved a problem and not submitted your solution, it won't show up here; you should go back and submit it. The problem numbers link to the problems.

    StatusProb.Your submitted solution

    Phase II

    • This year's Phase II problems cover multiple domains, including Bioinformatics, Finance, Information Retrieval, Algorithm Development, Text Processing and Recreational Computing. Each problem has been assigned a difficulty level – low, medium or hard – based on the judges' impressions. Each problem consists of one or more tasks.

    • You must solve at least 1 (one) problem to be considered for a prize; if a problem has more than one task then you need to solve all its tasks for the problem to be considered solved. We encourage you to solve as many problems as possible; if two entries are comparable in every other aspect, the one that solves more problems will likely receive higher consideration.

    • Some of the examples are displayed using the user command setting ]Boxing on to more clearly depict the structure of the displayed data. For example:

            ('Dyalog' 'APL')(4 4⍴⍳16) 5
        Dyalog  APL    1  2  3  4  5
                       5  6  7  8   
                       9 10 11 12   
                      13 14 15 16   
            ]Box on
      Was OFF
            ('Dyalog' 'APL')(4 4⍴⍳16) 5
      │┌──────┬───┐│ 1  2  3  4│5│
      ││Dyalog│APL││ 5  6  7  8│ │
      │└──────┴───┘│ 9 10 11 12│ │
      │            │13 14 15 16│ │

    Entering Phase II

    To enter Phase II you must have submitted at least one correct (silver or gold trophy) Phase I answer.

    • Download Contest2020.zip and unzip it.

    • Proceed with one of the workflows below depending on your development environment:

    • If you use Dyalog APL (recommended)
      • Load the Contest2020.dws workspace into the session using )LOAD Contest2020
      • You will develop your solutions in the namespace #.Problems which already contains:

        • syntactically-correct stubs for all of the functions described in the problem descriptions. These function stubs are implemented as traditional APL functions (tradfns) but you can change the implementation to dfns if you prefer. Either form is acceptable.

        • any sample data elements mentioned in the problem descriptions.

        Any sub-functions that you develop as a part of your solution should be located in #.Problems

      • If you want to be able to close APL and resume development of your solutions later, then make sure that you )SAVE the workspace.

      • When you're ready to submit your solutions, run the function #.SubmitMe, enter the requested information and click the Save button. This will create a file called Contest2020.dyalog containing any code or data that you placed in the #.Problems namespace.

      If you use some other APL system
      • Using any text editor, edit the Contest2020.dyalog template file. This file contains the correct structure for your submission.

      • Populate the structure with your code, but do not change the namespace structure. Once you have developed your solution, edit the AboutMe and Reaction variable definitions at the top of the file as indicated there.

      • Note that if you use a non-Dyalog APL system to develop your application, then it will still need to execute under Dyalog APL; your solution should, therefore, only use APL features that are common between your APL system and Dyalog.

    • Upload your Contest2020.dyalog file.
      You can upload this file more than once but only the final upload before the competition closes will be judged.

    File upload will be enabled once you have submitted one correct Phase I solution

    • No file currently selected for upload

    Your Phase II submission

    Welcome to the APL Problem Solving Competition!

    Learn APL, have fun, be a 2020 prizewinner!

    Dyalog Ltd invites you to use the APL programming language and your problem solving skills to compete for a total of USD 6,500 in cash prizes and a paid trip to the next Dyalog user meeting.

    Don't know APL?

    Would you like to be able to translate know-how into computer-based solutions quickly and efficiently? APL is an array-oriented programming language that will change the way you think about problems and data. It doesn't take long to learn enough to participate in the competition. Many previous winners of the competition learned APL after they heard about the competition. APL is easy to learn and fun to use, and this is your opportunity to profit from the experience!

    Don't have time?

    You can win a cash prize without writing a single line of code! Just refer someone to the competition, and if they win a cash prize then you'll receive the same amount as a referral award.

    If you're interested in the competition, but don't want to actively participate this year, please register – this will ensure that you're notified with updates on the competition.

    Are you ready?

    To proceed through the competition, hit Next .

    Discover APL

    Getting started with any new programming language can seem like a daunting task so we've tried to simplify this process for you:

    • Start by consulting the APL Wiki's comprehensive index of learning resources. In particular, look at the materials from previous competitions.

    • If you have a generally applicable question (not a competition-specific one!), consider posting it on Stack Overflow. APL questions are usually answered very quickly there.

    • For technical problems, FAQs, advice and tips, browse the Dyalog Forums.

    • If you need more personalized or interactive advice, consider consulting an experienced APLer in The APL Orchard chatroom.

    In addition, the core language is fully documented in the online documentation and the complete documentation set can be found in the Documentation Centre.


    Only those in full-time education are eligible to win the majority of prizes, although there is a non-student prize that is available if you're not in full-time education.

    You do not need to submit an entry in Phase II to win a Phase I prize, but to win a phase II or the non-student prize you must complete at least one Phase I problem and at least one problem in Phase II.

    We reserve the right to choose the winners at our sole discretion. Although not anticipated, competition rules and prizes can be changed or altered at any time. The judges' decision is final and no correspondence will be entered into by the judges in relation to their decisions.

    Grand prize

    USD 2,500 cash prize and an invitation to attend the next Dyalog user meeting. At the user meeting, the winner will receive their prize and have the opportunity to present their winning work. Dyalog Ltd will cover all user meeting fees and travel costs up to USD 3,500, plus USD 500 for incidental expenses, for the winner, but not for family or friends. The winning student is responsible for visas, travel documents and other necessary arrangements and must be legally able to travel.

    Update (07 July 2020): Traditionally, the Grand Prize winner of the APL Problem Solving Competition is invited to present their work at the annual Dyalog user meeting. Due to the lingering restrictions on travel and continued social distancing resulting from the COVID-19 pandemic, Dyalog ’20 will now take place online and the previously-planned Portugal user meeting will take place in October 2021. The Grand Prize winner will, therefore, be invited to present their work online during Dyalog ’20 and will receive an expenses-paid invitation to attend Dyalog ’21 in Olhão, Portugal, 10-14 October 2021. They will still also receive the cash prize of USD 2,500.

    Second prize

    USD 1,250 cash prize.

    Third prize

    USD 750 cash prize.

    Phase II prizes (5 random participants)

    USD 200 in cash to 5 participants who submit at least one correct entry for Phase II of the competition, selected at random.

    Phase I prizes (top 10)

    USD 100 in cash to each of the top 10 Phase I participants.

    Non-student prize

    One non-student participant will win complimentary registration and accommodation for the next Dyalog user meeting. The winning non-student is responsible for visas, travel documents and other necessary arrangements and must be legally able to travel.


    While all prizes are denominated in U.S. dollars, they can be awarded in U.S. dollars (USD), pounds sterling (GBP) or euros (EUR) by electronic transfer to a bank account or a PayPal account. No other forms of payment will be made.

    If you are selected as a winner and are unable or unwilling to accept the prize, you cannot transfer the prize or designate someone else as the winner. We reserve the right to award unclaimed prizes to the next highest scoring entrant.

    If you accept a prize, you will be solely responsible for all applicable taxes related to accepting that prize.

    Referral awards

    You can win referral awards equal in value to the main cash prizes won by participants who you introduce to the competition.

    You do not need to be a student or submit an entry yourself to earn a referral award. For example, if you are not a student but introduced the second prize winner and two winners of Phase II prizes, you would receive USD 1,650. If you are the student who won third prize and you also introduced the second prize winner, you would receive USD 2,000.

    How do I indicate who referred me? Put the name and email address of your referrer into the "Referrer" input box on your Account details form. This form can be found by clicking the email/username button at the top-right of this page after you've logged in.

    Note: All winners who did not indicate at the time of submission who introduced them will forfeit any matching referral awards. You cannot win a referral award for referring a participant of a previous competition.

    Data protection and cookies

    We use cookies to keep you logged in and to retain your solutions. By using this site, you agree to this.

    We only collect the data necessary for the competition to run, and will use any personal information submitted in accordance with Dyalog Ltd's Privacy Policy.

    At any time after you have registered and are logged in, you can erase all data that is stored about you as part of the competition by clicking the user button email@domain.com in the top right corner and selecting Erase account and data.

    Consent to usage of information

    By entering the competition, you consent to the use by Dyalog Ltd of all images, text and materials that you submit, for any purpose, in any media, for an unlimited period, without remuneration. We have the right to publish, display, reproduce, adapt, promote or otherwise use entries in any way we deem fit. You warrant that you are legally entitled to grant these rights to us and agree to indemnify us in the event that we suffer any loss as a result of false information you provide.

    By entering the competition you agree that if you win and subsequently participate in any promotional activities or material, you will do so without additional payment or permission.


    This site was constructed with, and runs on,

    MiServer, a free, open-source web server implemented in Dyalog APL. It enables the APL user to build sophisticated websites using the power of APL and with minimal knowledge of web technologies like HTML, JavaScript, and CSS.

    To safely verify phase I submissions, we use Dyalog APL through

    Try It Online, a family of online interpreters for an ever-growing list of practical and recreational programming languages.

    This site is protected by

    reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


    If you have feedback, or would like to ask a question that is not already answered here, please e-mail contest@dyalog.com.

    How to Participate

    The competition is free to enter. The deadline for submission is Friday 31 July 2020 at 23:00 UTC.

    Phase I

    Phase I asks you to solve 10 puzzles by writing short APL functions. You can begin Phase I without registering — you can experiment from your browser, and your solutions to Phase I problems will be stored by your browser until you decide to register and submit them. Select the Phase I: Submissions menu item to review the solutions that you've submitted.

    PDF of the Phase I problem set

    Phase I will mainly be judged based on:

    • Generality: does your function handle the given edge-cases? Is it even more general than required?

    • Use of array-oriented thinking: did you write array-oriented APL or something that looks like C# written in APL?

    Phase I solutions must be submitted using the  Submit button. Submitted solutions will appear on the Phase I: Submissions page.

    Phase II

    Phase II contains a collection of problem sets, each of which has been assigned a difficulty level – low, medium or hard – based on the judges' impressions. You must solve at least 1 (one) problem to be considered for a prize; if a problem has more than one task, then you need to solve all its tasks for the problem to be considered solved. When you have completed your solutions, you should upload a file containing your code. You need to have submitted at least one Phase I solution before you can upload a file for Phase II.

    PDF of the Phase II problem set

    The submission format is a Unicode text file describing a Dyalog namespace that contains your solutions. Your code can be written in any APL dialect but must be able to run in Dyalog APL version 16.0 or higher.

    Phase II will be judged mainly based on:

    • Completeness: did you solve the problem? Did you comment your code? (Phase I solutions should not be commented.)

    • Use of array-oriented thinking: did you write array-oriented APL or something that looks like C# written in APL?

    Running Dyalog APL

    Although TryAPL might be sufficient for solving the Phase I problems, for Phase II we highly recommend installing a desktop Dyalog APL development environment locally. It is free to download for all platforms (no registration required).

    Update (10 June 2020): Dyalog APL version 18.0 has now been released. To maintain a fair standard for all participants, Phase I will be judged based on version 17.1 which was the latest when the competition launched. The automated validation uses version 17.1 and will continue to do so. For phase II, upgrading to 18.0 offers new functionality and performance improvements over 17.1 but the version that you use will be taken into account by the judges and there is no version-dependent advantage to be gained by upgrading or remaining on an earlier version in terms of this competition. When you download Dyalog you will be offered both versions, and you can have both installed on your machine at the same time.

    Timeline for 2020

    These are the important dates in this year's competition:

    Friday, July 31, 2020 at 23:00 UTC

    The competition closes. All entries must be submitted by this time. It doesn't matter when you submit your entries as long as it's before this deadline. You can submit as many times as you like, only the final submission before the deadline will be judged. Submissions are judged only after the deadline has been reached.

    Friday, August 21, 2020

    Announcement of the winners of the competition (they will be formally notified by e-mail by this date).

    Detailed rules


    The competition is open to everyone except Dyalog employees and problem set contributors. Proof of full-time primary, secondary, college or graduate enrolment is necessary to win any of the prizes, except the non-student prize. You can be on a sabbatical as long as you will be returning to full-time student status within a year.


    All participants must submit to these rules.

    Participants can only compete with one entry in the competition. However, until the deadline, participants can submit replacement Phase I solutions and upload replacement Phase II solution files.

    Participants must provide truthful and accurate information regarding contact and personal information.

    All entry material must be presented and submitted in English.

    Only entries that are duly received by the deadline are eligible. We cannot accept responsibility for entries that are lost, delayed or damaged. Proof of sending an online entry is not proof that we received it.

    Entries not submitted in accordance with these terms and all other rules and directions, or entries that are incomplete or illegible (at the sole discretion of Dyalog Ltd) will be excluded from the competition.

    Your submission and its contents can be used at the discretion of Dyalog Ltd


    Participants must ensure that all solutions and answers are produced and owned by the participant. If multiple people make nearly identical Phase II submissions, all of them will be disqualified. For simpler Phase II problems the solutions are likely to end up being similar, so make your submission unique by adding comments in your own words, making it clear that you understand what your code does. You are allowed to collaborate with others in learning APL and solving the problems, but each submission must be made by a single individual and only that individual will be eligible for a prize. Each collaborator can submit their own entry, as long as each entrant's code is unique.

    If you choose to share your winnings with other people, then you must make your own arrangements. If you win the grand prize, then you can choose to send a collaborator to the user meeting instead of yourself, but that person is expected to be able to present the work competently.

    Until after the competition has closed, do not post your (partial) solutions online, nor seek help from services that provide peer review. We monitor various sites, and reserve the right to disqualify or penalise you for doing so.

    Frequently Asked Questions (FAQ)

    If you have feedback, or a question not answered here, please e-mail contest@dyalog.com.

    In APL, how do I...?

    In fairness to all, we cannot provide answers to contest-specific questions. Instead, have a look at the Discover APL resources.

    Can I utilise functions or code snippets from the workspaces that come with Dyalog (for example, dfns) or other sources?

    Yes. However, you will be judged both on the uniqueness of your code and evidence of your understanding of what you are doing. The judges read the Dyalog forums (and other similar channels) and will notice if contestants are asking for too much help. At a minimum, include comments (in your own words) indicating that you understand what the code is doing — don't just copy someone else's comments along with their code. If you really want to score well, you might want to see if you can improve on the code you find elsewhere.

    Does the possibility of winning prize money classify as commercial use of Dyalog APL?


    What do I do if there is a problem with the website or I have a question about a Phase II problem?

    Please report any problems or direct any questions to contest@dyalog.com.

    What are the recommended browsers for this site?

    We recommend the latest versions of Firefox, Safari, Chrome and Edge.

    I did not receive an email with a code when registering. What should I do?

    Hit Register again and wait for 5–10 minutes. Make sure you check your spam folder. If the code still doesn't come through, then please report the problem to contest@dyalog.com.


    We are not liable for any damage, loss or disappointment suffered by you for taking part or not being able to take part in this competition.

    In the event of unforeseen circumstances, we may alter, amend or cancel the competition without prior notice.

    We reserve the right to change these terms at any time.

    These terms are governed by the Laws of England and Wales and all disputes subject to the jurisdiction of the courts of England and Wales.

    Phase I: Introduction

    • The Phase I problems are designed to be solved using short APL dfns or tacit functions. If you find yourself writing more than a couple of statements in your solution, you can probably find a better way to do it.

    • A dfn is one or more APL statements enclosed in braces {}. The left hand argument, if any, is represented in a dfn by , while the right hand argument is represented by . For example:

            'Hello' {⍺,'-',⍵,'!'} 'world'

      A dfn terminates on the first statement that is not an assignment. If that statement produces a value, the dfn returns that value as its result. The diamond symbol separates APL statements. For example:

            'left' { ⍵ ⋄ ⍺ } 'right'

      For more information on dfns, use the APL Wiki.

    • A tacit function is an APL expression that does not explicitly mention its arguments. In the example below (+⌿÷≢) is a tacit function which computes the average of a vector (list) of numbers.

            (+⌿÷≢) 1 2 3 4 5 6

      For more information on tacit functions, see the APL Wiki.

    • Each problem has a description and one or more examples. Wherever you see "your_functionfn" is where you should insert your solution (either a dfn or tacit function). Do not add comments to your solutions; the competition judging committee has decades of experience reading APL code.

    • Your code must run in a default Dyalog environment using (⎕ML ⎕IO)←1. If you use other settings for ⎕ML or ⎕IO, they must be local. If you don't know what that means, don't worry, it won't matter to you.

    • Several of the problem descriptions will describe arguments that can be a scalar (a single element) or a vector (a list). This is largely pedantic, but in such cases your functions should produce correct results for both types of input.

    • The symbol is the APL comment symbol. In some of the examples, we provide comments to give you more information about the problem.

    • Some of the problem test cases use "boxed display" to make the structure of the returned results clearer. Boxing is enabled by default on TryAPL and can be enabled in your local APL Session with the ]Box user command:

       1  1 2  1 2 3  1 2 3 4 
            ]Box on
      Was OFF
      │1│1 2│1 2 3│1 2 3 4│