COSC 341/342 FALL 2015 Haskell mini project 2 Distributed 9/23/2015 Due 9/30/2015 All code should be place in a single file. You will write a function for each of the problems below. Use list comprehension and pattern matching when possible. You should not use a Haskell function that immediately solves the problem. All functions should be given type declarations. For function names, you should use the names I have supplied in the following problems. (1) Given a list, return the tail of the list (note: do not use Haskell's tail) tail' (2) Given a list of numbers, return product of the elements in the list (do not use Haskell's product) product' [2, 3, 4] returns 24 (3) Given a two tuples (x1, y1) and (x2, y2), return the city block distance between them: distance = abs (x1 - x2) + abs (y1 - y2) -- abs is the mathematical absolute value cityBlock (1, 3) (4, 4) returns 4 (4) Given two tuples (x1 y1) and (x2, y2), that are each (Number, Number), return the distance between the two points: distance = sqrt ( (x1 - x2) ^ 2 + (y1 - y2) ^2 ) You can use Haskell's sqrt euclid (5) Given two lists of numbers, return a list that is the sum of corresponding elements. sum'' [1, 2, 3] [4, 5, 6] returns [5, 7, 9] (6) Given a list (of any type) return the same list in reverse (do not use Haskell's reverse) reverse' (7) Given two lists, the first has a list of values of any type, the second has a list of Bool values. Return the list containing only values in the first list where the corresponding value in the second list is True. pickIt [1, 2, 3] [True, False, True] returns [1, 3] pickIt ['a', 'b', 'c'] [False, False, True] returns ['c'] (8) Given a list of 2-tuples, the first element of each tuple is a String, the second element of each tuple is a Bool. The function pack will return the list of tuples that contains only the tuples that have the Bool value set to True. That is, the Bool value of each tuple can be thought of as a 'delete' bit. Example: pack [ ("a", True), ("b", False), ("c", False), ("d", True) ] returns [ ("a", True), ("d", True) ] Turn in: - hard copy of source code - screen shot showing each function's execution on all legal inputs.