Question: For all questions in this assignment, write Haskell code that computes the specified function. Use good Haskell style by including in your code the signature
For all questions in this assignment, write Haskell code that computes the specified function. Use good Haskell style by including in your code the signature of each top-level function above its definition (most signatures are actually provided in the questions). You can include as many other (helper) functions as you like.
Once again , please write the code in haskell language.
a) Write a function palindrome : [Char]Bool that tells you whether a given string is a palindrome, i.e., whether it is identical when read left-to-right and right-to- left. (b) Write a function oddEvenCount [Int] (Int, Int) that receives a list of integers and returns a pair (a, b), where a and b stand for the number of odd and even integers, respectively, that are contained in the list. (c) Write a function caesar :: [Char][Char] that receives a string of small letters and returns its encoding in Caesar's code. This means that every 'a' turns into a 'b', every 'b' into a c', every c' into a 'd', and so on, and finally, every 'z' into an a. Hint: Look at the successor function succ to make your life easier. a) Write a function palindrome : [Char]Bool that tells you whether a given string is a palindrome, i.e., whether it is identical when read left-to-right and right-to- left. (b) Write a function oddEvenCount [Int] (Int, Int) that receives a list of integers and returns a pair (a, b), where a and b stand for the number of odd and even integers, respectively, that are contained in the list. (c) Write a function caesar :: [Char][Char] that receives a string of small letters and returns its encoding in Caesar's code. This means that every 'a' turns into a 'b', every 'b' into a c', every c' into a 'd', and so on, and finally, every 'z' into an a. Hint: Look at the successor function succ to make your life easier
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
