Question: HASKELL LANGUAGE In this assignment, you are going to write a recursive function to count the number of odd elements in an Integer list. The

HASKELL LANGUAGE

HASKELL LANGUAGE In this assignment, you are going to write a recursivefunction to count the number of odd elements in an Integer list.

In this assignment, you are going to write a recursive function to count the number of odd elements in an Integer list. The signature of this function is: countodd [Integer] Integer For example: countodd [1, 2, 3, 4, 5] 3 countodd [2, 4, 6, 8] 0 .countodd [1, 3, 5, 1, 3, 5, 1, 3] 8 Here is the algorithm to find the number of odd values recursively: There is no odd element in an empty list. If the list is not empty, let it be x: xs (that is, x is the head and xs is the tail), then countodd (xxs) =.countodd xs ifx is even ifxis odd t countodd xs The remaining 5 points will be awarded based on the structure, readability, and documentation of your implementation. Documentation should be in the form of Haskell comments, which start with"-"and extend until the end of the line. You cannot have any import statement in your program. And you can only use functions in the Prelude module. The Prelude function odd (signature: odd : Integral aaBool can be use to test whether an integer is odd or not) There can be only one single function (the countodd function) defined in the "csc207a2.hs" file. No other helper function(s) is/are allowed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!