Skip to content

9. Up and Down

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.

The , (Join) function joins the list on its left to the list on its right, forming a single bigger list. For example 1 2 3 , 8 9 gives 1 2 3 8 9 and 'DYALOG' , 'APL' gives DYALOGAPL.


Using what you’ve learnt so far, write a function that counts up to a given number and down again. For example:

      {answer} 4
1 2 3 4 3 2 1

      {answer} 5
1 2 3 4 5 4 3 2 1

      {answer} 2
1 2 1