Skip to content

7. O, Thus Be It

Note: In this problem, you’re asked to enter your own APL function, without giving it any arguments. Your function will be checked by the APL Challenge system using several tests to see whether it is correct.

You can create your own function by putting an expression in curly brackets ( {} ). For example, the expression 2+3 becomes the function {2+3}. You can let the function take an argument by using (omega, the right-most letter of the Greek alphabet) in the expression; any is replaced by the argument to the right of the closing curly bracket ( } ).

For example, a function that multiplies its argument by two could be written {2×⍵}. Then:

  1. {2×⍵} 5 gives 10
  2. {2×⍵} 7 gives 14

Using what you learnt in problem 6 to write a function which takes text and answers whether it contains the uppercase letter 'O'. For example:

      {answer} 'DYALOG'
1

      {answer} 'APL'
0

      {answer} 'HELLO WORLD'
1