4. Table Motions
Note: In this problem, you’re asked to enter an APL expression (some APL code), including arguments (data given to APL symbols). Your code will be tested by the APL Challenge system to check whether it gives the correct answer and uses the methods described below.
Symbols that are used to change data are called functions. For example, APL uses the function × (Times) for multiplication.
When we write an expression and its result together, we often write the code above the result, with six spaces to the left of the code, so for example:
2+2
4
If you put ∘. (jot dot, but sometimes called table) immediately to left of a function, then it produces a table for that function. It does this by inserting the function into each combination that can be made with a number from the left list and a number from the right. If the resulting table had row and column headings, the left argument would be used as the headings for the rows (down the left side) and the right argument would be used as the headings for the columns (across the top).
For example, here’s a multiplication table as you might see it in a book:
| × | 2 | 3 | 4 | 5 |
|---|---|---|---|---|
| 2 | 4 | 6 | 8 | 10 |
| 3 | 6 | 9 | 12 | 15 |
| 4 | 8 | 12 | 16 | 20 |
And here is the same table in APL form:
2 3 4 ∘.× 2 3 4 5
4 6 8 10
6 9 12 15
8 12 16 20
Use ∘. with ⊃ from problem 3 to pick letters 1 and 5 from each of the words 'OPIUM' 'HEAVY'. The result should be:
OH
MY