5. What, where?!
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.
An APL function takes the result of all code to its right as its right argument (the data on the right of the symbol). For example, 2×3+4 gives 14 (rather than the 10 you might expect) because the × takes the result of 3+4 as its right argument.
You can use round brackets ( (…) ) to change the order in which things are calculated. When used, the right argument only goes as far as the nearest closing bracket on its right:
2×3+4gives14because×takes the result of all code to its right,3+4, as its right argument.2×(3+4)gives14because×takes the result of all code to its right,(3+4), as its right argument.(2×3)+4gives10because the right argument of×only goes as far as the nearest closing bracket.
Remember from problem 1 that APL uses 1 and 0 for yes
and no
. The And function ∧ (looks a bit like the letter A for And) allows you to combine such values; it gives 1 if both left and right arguments are 1, but 0 if either is 0. For example, 1 1 0 0 ∧ 0 1 0 1 gives 0 1 0 0, because:
0no
:1isyes
but0isno
1yes
:1and1are bothyes
0no
: neither0nor0is areyes
0no
:0isno
, even though1isyes
Write an expression that uses = from problem 1, ⊃ from problem 3, and round brackets, to show that the 2nd letter of 'DYALOG' is a 'Y' and that the 6th letter of 'DYALOG' is a G. The result should be 1 for yes
.