Question: Please Use Haskell 1.Write a function middleWord that that returns the second word in a string that is composed of exactly three words. Assume that
Please Use Haskell
1.Write a function middleWord that that returns the second word in a string that is composed of exactly three words. Assume that always exactly three words are present, and that words are separated by the single space 2 character: ' '. For example, Haskell is fun! should return "is". (Hint: which helper functions would be useful to define?) middleWord :: String -> String
2.Write a function pushRight that takes a string and and an integer n and forms a string of length n by putting spaces at the front of the string. (n is guaranteed to be greater than or equal to the length of the string, and no more than 40.) For example, pushRight "crocodile" 12 should return " crocodile" (three leading spaces). pushRight :: String -> Int -> String
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
