Edit this page Backlinks This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== 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 takes a list of pairs ''Name-Age'' and returns the average age of names called ''Ana''. 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) Consider a 8x8 chessboard which contains only rooks, encoded as a matrix. The presence of a rook on a position is encoded by the character 'R'. The character ' ' encodes a free position. Write a function which takes a chessboard and returns true if two rooks attack each other.