3. Picky Picky
In this problem, you’re asked to enter some APL code, including an APL symbol and the data (text or numbers) given to it. Your code will be tested by the APL Challenge system to check whether it gives the correct answer and uses the methods described below.
The symbol ⊃ (Pick), when given a number (let’s call it n) on its left and a list on its right, it picks item number n from the list. For example, 2 ⊃ 'DYALOG' gives Y and 2 ⊃ 'DYALOG' 'APL' gives APL.
So far, we’ve only used text (in single quotes) and lists of numbers like 'DYALOG APL' and 3 1 4 1 5 9. Both of these are simple lists; one is a list of letters (we count space as a letter), the other is a list of numbers (the spaces between numbers don’t count). APL can also handle lists of lists, and so on. For example, 'DYALOG' 'APL' is a list of two texts, that is, a list of two lists of letters.
If we want additional levels of lists inside lists, we use round brackets to mark each list. For example, (1 2 3) (2 7 1 8) is a list of two lists of numbers, and ('KEN' 'IVERSON') ('DYALOG' 'APL') is a list of lists of texts (with each text itself being a list of letters).
If we give ⊃ a list of numbers (rather than a single number) on the left (we’ll still call it n), then:
- the first number from n picks the appropriate item from the list on the right of
⊃ - the second number from n picks the appropriate item from that list
- and so on
For example, 2 1 ⊃ 'DYALOG' 'APL' will pick:
- item
2from'DYALOG' 'APL', which is'APL' - item
1from'APL', which is'A'
Write a line of APL using ⊃ that will pick the 'G' from ('KEN' 'IVERSON') ('DYALOG' 'APL').