Question: Your submitted file must be interpretable by GHCi interpreter in Haskell (a) Define function toUppr :: Char -> Char that receives a character and returns

Your submitted file must be interpretable by GHCi interpreter in Haskell

(a) Define function toUppr :: Char -> Char that receives a character and returns the uppercase if the input is lowercase. Otherwise, it returns the input character. For example, if the input is g then the output must be G. If the input is H or @ then the output must be H or @, respectively. Hint: Check if the input is lowercase ([a..z]). If so, compute the index using the already-defined function findInd, and extract the associated character from [A..Z], using that index. Do not perform pattern matching on all possible alphabetic characters!

(b) Use list comprehensionsto define function trimThird :: (Eq a) => [a] -> [a] that receives a list of items that at most appear once in that list, and eliminates every third item from that list. For example, if the input is [a..z] then the output must be "abdeghjkmnpqstvwyz".

(c) Use list comprehensions to define function trimAlpha :: String -> String that receives a string and eliminates every alphabetic (uppercase and lowercase) characters from that string. For example, if the input is "Ks%bU#n9x" then the output must be "%#9".

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!