Exam example 1
1. (2p) Write a function in Haskell which returns the last element of a list.
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 DNA bases: ('A', 'C', 'G', 'T'). Write a function which checks if two DNA sequences are complementary. 'A' is complementary to 'T' and 'C' to 'G'. For instance, AGTC
is complementary to TCAG
.
4. (1p) Write a function which takes an image (as encoded in the homework), a value k, and creates a k x k
tiling of the image.
Example:
.*. img = **. ... .*..*..*. **.**.**. ......... .*..*..*. tile 3 img = **.**.**. ......... .*..*..*. **.**.**. .........