Previous Up

4.13  Exercises



  1. Using a do loop, write a predicate which, when given a 1-d array, returns a list containing the elements of the array in reverse order.



  2. Write a predicate transpose(Matrix, Transpose) to transpose a 2-d array.

    Can you make it work backwards? (i.e. if Transpose is specified, can you make it return a suitable Matrix?)

Previous Up