This is an old revision of the document!


Exam example 2

1. (2p) Write a function in Haskell which extracts all even positions from a list. Example f [1,2,3,4,5] = [1,3,5]

2. (2p) Write a function which removes those strings from a list, which are not in the date format. A correct date format is considered: DD.MM.YYYY where D,M,Y can be any digit.

3. (2p) Implement an Algebraic datatype which encodes semaphores. A semaphore has a color (red, green, yellow). Write a function which checks if a list of semaphores is synchronised (all semaphores have the same color).

4. (1p) Suppose Example:

      .*.
img = **.
      ...
              .*..*..*.
              **.**.**.
              ......... 
              .*..*..*.
tile 3 img =  **.**.**.
              .........
              .*..*..*.
              **.**.**.
              .........