Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
fp:exam2021:l2 [2021/06/03 15:26]
pdmatei
fp:exam2021:l2 [2021/06/03 15:43] (current)
pdmatei
Line 3: Line 3:
 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]''​ 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.+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). 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).