COSC 341 FALL 2015 Haskell mini project Distributed 9/16/2015 Due 9/23/2015 For (1), see #2.f for a different option. (1) For the following built-in Haskell functions (and operators), complete this table (for preference, use chapter 1 of the Haskell book, however any source of information is acceptable). I have filled in the first and third rows, function prefix/ # parameters parameter types example description infix ---------------------------------------------------------------------------------------------------------- && infix 2 Boolean, Boolean x>5 && True logical AND not succ prefix 1 enumerable types succ 'a' succeeding element e.g., char, int `div` ++ : !! .. <= <- | head tail init last length reverse take drop elem `elem` sum fst snd zip (2) Using list comprehension and filtering as much as possible, write and demonstrate functions that do the following. You can (and, whenever reasonable you should) use more than one function for each solution. You can use your own choice of names for functions, however each solution must be clearly commented, e.g., -- Solution 2.e -- 2.a. Obtain the list of numbers that are the squares of integers in a list of numbers. 2.b. Obtain the list of numbers that are the square root of the integers in a list of integers; the resulting list contains only the integer valued square roots. For the list [ 0 .. 16 ], the correct result is [0, 1, 2, 3, 4] 2.c. Obtain the string by removing all vowels ['a', 'e', 'i', 'o', 'u') from a given string. 2.d. For a 6-sided die, obtain all the ways you can get a 4 from the sum of two dice. The correct answer is [ [1,3], [3,1], [2,2] ] 2.e. Given a list of names: e.g., ["a", "b", "c"] and a list of numbers: e.g., [1, 2], Create a list of tuples with all combinations: The answer is [ ("a", 1), ("b", 1), ("c", 1), ("a", 2), ("b", 2), ("c", 2) ] --------------------------------------------------------------------------------- If you choose, you can answer 2f instead of #1. 2.f. From a list of tuples [ ( [Char], Num ) ] output those tuples that have the Num value less than 10. For example: [ ("aaa", 100), ("bbb", 1000), ("ccc", 2) , ("ddd", 2) ] should yield [ ("ccc", 2), ("ddd", 2) ]