Question: Using Haskell Identify the base case, and what the function should return in that case. In the recursive case, identify how knowing the result of

Using Haskell
Identify the base case, and what the function should return in that case. In the recursive case, identify how knowing the result of calling the function recursively on the tail of the list will enable you to compute the answer for the entire list.
6. removeEvens :: [Integer] -> [Integer] removes all even elements from the given list. EG, removeEvens [0,1,2,2,3,3,3,4] [1,3,3,3]. 7. doubleAll :: [Integer] -> [Integer] multiplies all entries in the list by 2: doubleAll (1,2,300] = [2,4,600] 8. flatten :: [[a]] -> [a] takes a list of lists, and returns a single list in which all the smaller lists have been concatenated together. flatten [[1,2,3] , [5,9] , [7,-1]] = [1,2,3,5,9,7,-1] flatten ("hello", "new","world"] = "hellonewworld" 9. countInt :: Integer -> [Integer] -> Integer, where countInt n 1 returns the number of times the integer n occurs in list 1. countInt 2 (1,2,3,4,3,2,1,2] 10. countEq :: Eq a => a => [a] -> Integer, similar to the above, but general- ized to work for any type which implements the equality predicate countEq 2 (1,2,3,4,3,2,1,2] = 3 countEq "the" ["the", "dog", "barked","at","the", "cat"] = 2 = 3 == 6. removeEvens :: [Integer] -> [Integer] removes all even elements from the given list. EG, removeEvens [0,1,2,2,3,3,3,4] [1,3,3,3]. 7. doubleAll :: [Integer] -> [Integer] multiplies all entries in the list by 2: doubleAll (1,2,300] = [2,4,600] 8. flatten :: [[a]] -> [a] takes a list of lists, and returns a single list in which all the smaller lists have been concatenated together. flatten [[1,2,3] , [5,9] , [7,-1]] = [1,2,3,5,9,7,-1] flatten ("hello", "new","world"] = "hellonewworld" 9. countInt :: Integer -> [Integer] -> Integer, where countInt n 1 returns the number of times the integer n occurs in list 1. countInt 2 (1,2,3,4,3,2,1,2] 10. countEq :: Eq a => a => [a] -> Integer, similar to the above, but general- ized to work for any type which implements the equality predicate countEq 2 (1,2,3,4,3,2,1,2] = 3 countEq "the" ["the", "dog", "barked","at","the", "cat"] = 2 = 3 ==
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
