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.

2019
image/svg+xml
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 could be helpful for this problem.

Examples

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

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
3
      (+/∊∘'AEIOU') 'COOLAPL'   ⍝ good tacit function
3
      ⍝ suboptimal dfn:
      {(+/⍵='A')+(+/⍵='E')+(+/⍵='I')+(+/⍵='O')+(+/⍵='U')} 'COOLAPL'   ⍝ suboptimal dfn
3

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.

Phase I Problem Set

your_function ←fn ←

1: Chunky Monkey

Write a function that, given a scalar or vector as the right argument and a positive (>0) integer chunk size n as the left argument, breaks the array's items up into chunks of size n. If the number of elements in the array is not evenly divisible by n, then the last chunk will have fewer than n elements.

Hint: The partitioned enclose function could be helpful for this problem.

Examples

       3 (your_functionfn) ⍳9   ⍝ ]Box on is used to display the result
┌─────┬─────┬─────┐
│1 2 3│4 5 6│7 8 9│
└─────┴─────┴─────┘

      3 (your_functionfn) ⍳11
┌─────┬─────┬─────┬─────┐
│1 2 3│4 5 6│7 8 9│10 11│
└─────┴─────┴─────┴─────┘

      10 (your_functionfn) 'Dyalog'
┌──────┐
│Dyalog│
└──────┘

      2 (your_functionfn) 'The' 'cat' 'in' 'the' 'hat' 'sat' 'pat'
┌─────────┬────────┬─────────┬─────┐
│┌───┬───┐│┌──┬───┐│┌───┬───┐│┌───┐│
││The│cat│││in│the│││hat│sat│││pat││
│└───┴───┘│└──┴───┘│└───┴───┘│└───┘│
└─────────┴────────┴─────────┴─────┘

      5 (your_functionfn) ''   ⍝ result is 0-element vector of text vectors
    
      
      4 (your_functionfn) 5
┌─┐
│5│
└─┘
your_function ←fn ←

2: Making the Grade

Score Range Letter Grade
0–64 F
65–69 D
70–79 C
80–89 B
90–100 A

Write a function that, given an array of integer test scores in the inclusive range 0–100, returns an identically-shaped array of the corresponding letter grades according to the table to the left.

Hint: You may want to investigate the interval index function .

Examples

      (your_functionfn) 0 64 65 69 70 79 80 89 90 100
FFDDCCBBAA

      (your_functionfn) ⍬  ⍝ returns an empty vector


      (your_functionfn) 2 3⍴71 82 81 82 84 59
CBB
BBF
your_function ←fn ←

3: Grade Distribution

The school's administrative department wants to publish some simple statistics. Given a non-empty character vector of single-letter grades, produce a 3-column, 5-row, alphabetically-sorted matrix of each grade, the number of occurrences of that grade, and the percentage (rounded to 1 decimal position) of the total number of occurrences of that grade. The table should have a row for each grade even if there are no occurrences of a grade. Note: due to rounding the last column might not total 100%.

Hint: The key operator could be useful for this problem.

Examples

      (your_functionfn) 9 3 8 4 7/'DABFC'
A 3  9.7
B 8 25.8
C 7 22.6
D 9 29  
F 4 12.9

      (your_functionfn) 20⍴'ABC'
A 7 35
B 7 35
C 6 30
D 0  0
F 0  0

      (your_functionfn) ,'B'
A 0   0
B 1 100
C 0   0
D 0   0
F 0   0
your_function ←fn ←

4: Knight Moves (with apologies to Bob Seger)

1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8
2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8
3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8
4 1 4 2 4 3 4 4 4 5 4 6 4 7 4 8
5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8
6 1 6 2 6 3 6 4 6 5 6 6 6 7 6 8
7 1 7 2 7 3 7 4 7 5 7 6 7 7 7 8
8 1 8 2 8 3 8 4 8 5 8 6 8 7 8 8

Consider a chess board as an 8×8 matrix with square (1 1) in the upper left corner and square (8 8) in the lower right corner. For those not familiar with the game a chess, the knight, generally depicted as a horse ( ), can move 2 spaces right or left and then 1 space up or down, or 2 spaces up or down and then 1 space right or left. This means that a  knight  on square (5 4) can move to any of the  indicated  squares.

Given a 2-element vector representing the current square for a knight, return a vector of 2-element vectors representing (in any order) all the squares that the knight can move to.

Hint: The outer product operator ∘. could be useful for generating the coordinates.

Examples

      (your_functionfn) 5 4   ⍝ ]Box on is used to display the result
┌───┬───┬───┬───┬───┬───┬───┬───┐
│3 3│3 5│4 2│4 6│6 2│6 6│7 3│7 5│
└───┴───┴───┴───┴───┴───┴───┴───┘

      (your_functionfn) 1 1
┌───┬───┐
│2 3│3 2│
└───┴───┘
your_function ←fn ←

5: Doubling Up

Given a word or a list of words, return a Boolean vector where 1 indicates a word with one or more consecutive duplicated, case-sensitive, letters. Each word will have at least one letter and will consist entirely of either uppercase (A-Z) or lowercase (a-z) letters. Words consisting of a single letter can be scalars.

Hint: The nest function could be useful.

Examples

      (your_functionfn) 'I' 'feed' 'the' 'bookkeeper'
0 1 0 1

      (your_functionfn) 'I' 
0

      (your_functionfn) 'feed' 
1

      (your_functionfn) 'MY' 'LLAMAS' 'HAVE' 'BEEN' 'GOOD' 
0 1 0 1 1      
your_function ←fn ←

6: Telephone Names

1 2ABC 3DEF
4GHI 5JKL 6MNO
7PQRS 8TUV 9WXYZ
* 0 #

Some telephone keypads have letters of the alphabet embossed on their keytops. Some people like to remember phone numbers by converting them to an alphanumeric form using one of the letters on the corresponding key. For example, in the keypad shown, 'ALSMITH' would correspond to the number 257-6484 and '1DYALOGBEST' would correspond to 1-392-564-2378.

Write an APL function that takes a character vector right argument that consists of digits and uppercase letters and returns an integer vector of the corresponding digits on the keypad.

Hint: Your solution might make use of the membership function .

Examples

      (your_functionfn) 'IAMYY4U'
4 2 6 9 9 4 8

      (your_functionfn) ''   ⍝ should return an empty vector


      (your_functionfn) 'UR2CUTE'
8 7 2 2 8 8 3
your_function ←fn ←

7: In the Center of It All

Given a right argument of a list of words (or possibly a single word) and a left argument of a width, return a character matrix that has width columns and one row per word, with each word is centered within the row. If width is smaller than the length of a word, truncate the word from the right. If there are an odd number of spaces to center within, leave the extra space on the right.

Hint: The mix and rotate functions will probably be useful here.

Examples

      10 (your_functionfn) 'APL' 'Problem' 'Solving' 'Competition'
   APL    
 Problem  
 Solving  
Competitio

      3 (your_functionfn) 0⍴⊂''   ⍝ result should be 0-row, 3-column matrix
your_function ←fn ←

8: Going the Distance

Created by Causeway SVG engine - SharpPlot v3.61.0 Border ===== Region ===== X-Axis Ticks ===== X-Axis Grid X-Axis tickmarks Y-Axis Ticks ===== Y grid Y-Axis tickmarks Axes ===== Arrowhead(s) for the axes Y-axis labels ¯2 ¯1 1 2 3 for X-axis labels ¯2 ¯1 1 2 Heading, subheading and footnotes ===== Start of Line Chart =========== Points follow ... Line Data value labels ... A←(¯1.5 ¯1.5) B←(1.5 2.5) C←(1.5 ¯1.5) Reset to original origin

Given a vector of (X Y) points, or a single X Y point, determine the total distance covered when travelling in a straight line from the first point to the next one, and so on until the last point, then returning directly back to the start.

For example, given the points (A B C) ← (¯1.5 ¯1.5) (1.5 2.5) (1.5 ¯1.5), the distance A to B is 5, B to C is 4 and C back to A is 3, for a total of 12.

Hint: The rotate and power * functions might be useful.

Examples

      (your_functionfn) (1 ¯1)(1 3)   ⍝ from A to B and back to A
8

      (your_functionfn) (1 1)(1 2)(2 2)(2 1)   ⍝ from A to B to C to D to A
4

      (your_functionfn) 5 5   ⍝ staying where we are
0

      (your_functionfn) (1 1)(3 3)   ⍝ there and back again
5.656854249
your_function ←fn ←

9: Area Code à la Gauss

Gauss's area formula, also known as the shoelace formula, is an algorithm to calculate the area of a simple polygon (a polygon that does not intersect itself). It's called the shoelace formula because of a common method using matrices to evaluate it.

For example, the area of the triangle described by the vertices (2 4)(3 ¯8)(1 2) can be calculated by walking around the perimeter back to the first vertex, then drawing diagonals between the columns as shown below. The pattern created by the intersecting diagonals resembles shoelaces, hence the name shoelace formula.

Hint: You may want to investigate the rotate first function.

First place the vertices in order above each other:
2 4
3 ¯8
1 2
2 4
Sum the products of the numbers connected by the diagonal lines going down and to the right:

      (2ׯ8)+(3×2)+(1×4)
¯6
2 4
3 ¯8
1 2
2 4
Next sum the products of the numbers connected by the diagonal lines going down and to the left:

      (4×3)+(¯8×1)+(2×2)
8
2 4
3 ¯8
1 2
2 4
Finally, halve the absolute value of the difference between the two sums:

      0.5 × | ¯6 - 8
7
2 4
3 ¯8
1 2
2 4

Given a vector of (X Y) points, or a single X Y point, return a number indicating the area circumscribed by the points.

Examples

      (your_functionfn) (2 4)(3 ¯8)(1 2)
7

      (your_functionfn) (1 1)   ⍝ a point has no area
0

      (your_functionfn) (1 1)(2 2)   ⍝ neither does a line
0
your_function ←fn ←

10: Odds & Evens

Given a vector of words, separate the words into two vectors – one containing all the words that have an odd number of letters and the other containing all the words that have an even number of letters.

Hint: You may want to look into the dyadic form of the key operator .

Examples

      (your_functionfn) 'the' 'plan' 'is' 'great'   ⍝ ]box on is used to display the result
┌───────────┬─────────┐
│┌───┬─────┐│┌────┬──┐│
││the│great│││plan│is││
│└───┴─────┘│└────┴──┘│
└───────────┴─────────┘

      (your_functionfn) 'all' 'odd' ⍝ note the empty 2nd element of the result
┌─────────┬┐
│┌───┬───┐││
││all│odd│││
│└───┴───┘││
└─────────┴┘

      (your_functionfn) 'only' 'even' 'here' ⍝ note the empty 1st element of the result
┌┬────────────────┐
││┌────┬────┬────┐│
│││only│even│here││
││└────┴────┴────┘│
└┴────────────────┘
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
1
2
3
4
5
6
7
8
9
10

Phase II

  • This year's Phase II consists of nine problem sets across a variety of domains, including Bioinformatics, Mathematics, Cryptography, Language Processing and Recreational Computing. There are three levels of problem set difficulty – low, medium and hard.

  • A problem set consists of three or more problems, and each problem will require you to write one or more functions or operators. You need to solve all of the problems within a problem set for the problem set to be considered for judging. You do not need to solve all the Phase II problem sets to be considered eligible for the top three prizes, but you do need to complete, at a minimum, one problem set of each level of difficulty.

  • Solving more than the minimum problem sets can work in your favor in two ways:

    • We judge based on what we deem to be your best submission from each level of difficulty, so solving more problems will never lower your score.

    • If entries from two people are of similar quality but one person has solved more problems, then that entry will receive higher consideration by the judging committee.

  • Some of the examples are displayed using the user command setting ]Box 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 Contest2019.zip and unzip it.

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

  • If you use Dyalog APL (recommended)
    • Load the Contest2019.dws workspace into the session using )LOAD Contest2019
    • 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. The function stubs are implemented as traditional APL functions (tradfns) but you can change the implementation to dynamic functions (dfns) if you want to do so. Either form is acceptable.

      • any sample data elements mentioned in the problem descriptions.

      Any sub-functions 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, make sure to )SAVE the workspace.

    • When you're ready to submit your solutions, run the function #.SubmitMe. It will prompt you for some information and create a file called Contest2019.dyalog containing any code or data you placed in the #.Problems namespace.

    If you use some other APL system
    • Using any text editor, edit the Contest2019.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 variable definitions at the top of the file as indicated there.

    • Note that your code still needs to execute under Dyalog APL.

  • Upload Phase II's Contest2019.dyalog file.
    You can upload this file more than once but only the latest upload 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 2019 APL Problem Solving Competition!

Dyalog 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 2019 Dyalog user meeting in Elsinore, Denmark (September 8–12, 2019).

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 this competition. Many previous winners of this 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, you'll receive the same amount as a referral award.

If you're interested in the competition, but do not wish to participate actively, feel free register any way, as this will sign you up for 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. The following resources are free of charge and aimed at APL novices:

  • Mastering Dyalog APL by Bernard Legrand is a complete guide to the use of Dyalog, beginning with a thorough introduction to the APL programming language and progressing to worked examples. It can be downloaded for free or purchased in print.

  • TryAPL is an online tool offering an interactive environment that allows users to play with simple APL expressions. It includes a tutorial mode in which various scenarios are explored.

  • The APL tutor is an online system that takes a complete novice through the terminology, conventions and functionality of APL (not specific to Dyalog's dialect).

  • APL Cultivation is a Stack Exchange repository of text-based lesson transcripts.

  • The APL Orchard is a Stack Exchange chatroom for asking questions while learning APL.

  • Stack Overflow is a question & answer site where APL questions are usually answered very quickly.

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

Further resources

Further resources are available at Dyalog's website. The following resources may be of particular interest:

Prizes

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 the grand, second, third or non-student prize, you must complete at least one Phase I problem and at least a minimum set of solutions in Phase II.

We reserve the right to choose the winners at our sole discretion. Although not anticipated, competition rules and prizes may 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 2019 Dyalog user meeting in Elsinore, Denmark (September 8–12, 2019). At the user meeting, the winner will receive their prize and have the opportunity to present their winning work. Dyalog 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.

Second prize

USD 1 250 cash prize.

Third prize

USD 750 cash prize.

Phase I prizes (top 10)

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

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.

Non-student prize

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

Payout

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 may 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 any cash prizes won by contestants that 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 introduced the second prize winner and two winners of Phase II prizes, you would receive USD 1 650. If you were 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 button at the top-right of this site.

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 this 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 this 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 this 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.

Technology

This site itself 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 running in a container on

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.

Contact

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

How to Participate

The competition is free to enter, and closes on Friday 26 July, 2019 at 23:00 UTC. All entries must be submitted by then.

Phase I

Phase I requires 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 Submissions menu item to review the solutions you've submitted.

A PDF of the Phase I problem set is available.

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 that are rated easy, medium and difficult. Each problem set contains three or more problems. You must solve all of the problems in a problem set for the set to be considered solved. To be eligible for the grand, second, or third prize, you must solve at least one problem set of each rating. When you have completed your solutions, you must upload a file containing your code. You must submit at least one Phase I solution before you can upload a file for Phase II.

The submission format is a Unicode text file describing a Dyalog namespace that contains your solutions. Your code 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

To solve the Phase I problems, TryAPL may be adequate, but for Phase II, we highly recommend installing the Dyalog APL development environment locally. It is available for free on Windows, macOS, Linux — just apply for a licence — and on Raspberry Pi without having to apply for a licence.

Timeline for the 2019 Competition

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

Friday, July 26, 2019 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. Submissions are judged only after the deadline has been reached.

Monday, August 5, 2019

The winners of the competition are announced (they will be formally notified by e-mail, post, or telephone no later than by this date).

Sunday–Thursday, September 8–12, 2019

Dyalog user meeting in Elsinore, Denmark.

Detailed rules

Eligibility

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.

Conditions

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.

Collaboration

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 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.

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

Frequently Asked Questions (FAQ)

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

In APL, how do I...?

In fairness to all, we cannot provide answers to APL-specific question. That being said, 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?

No.

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 contest2019@dyalog.com.

What are the recommended browsers for this site?

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

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 contest2019@dyalog.com.

Disclaimers

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'
    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'
    right

    For more information on dfns, use the online help or see page 152 in Mastering Dyalog APL.

  • 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
    3.5

    For more information on tacit functions, see the release notes and the online help.

  • 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 single character vector (string) or a vector of character vectors (a list of strings). 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:

          ⍳¨⍳4
     1  1 2  1 2 3  1 2 3 4 
          ]Box on
    Was OFF
          ⍳¨⍳4
    ┌─┬───┬─────┬───────┐
    │1│1 2│1 2 3│1 2 3 4│
    └─┴───┴─────┴───────┘

PLEASE WAIT