Statistics:
mean 21.909 (241.000/11) stddev 5.648 median 23.000 midrange 17.750-25.000 # avg 1 7.73 / 10 2 4.36 / 10 3 7.82 / 10 + 2-point bonus
Write a Haskell function countZeroes that takes a list of integers as a parameter and returns the number of zeroes contained in the list. For example, if I called countZeroes [5,0,0,8,0], it should return 3, since the list contains three zeroes.
Write a Haskell function named doubleFunc which takes as its parameter a function f from integers to integers and returns a function from integers to integers which is always twice f. For example, using this function I should be able to do the following.
With these definitions, fd 3 should return 2 f(3) = 2 (3 + 5) = 16$ and gd 10 should return 2 (3 * 10) = 60.f x = x + 5 g x = 3 * x fd = doubleFunc f gd = doubleFunc
Reduce the following lambda expression, showing your intermediate steps. It should reduce to a number.
countZeroes [] = 0 countZeroes (0:xs) = 1 + countZeroes xs countZeroes (_:xs) = countZeroes xs