Question: 4. Write a recursive Haskell function makeString :: Integer -> Char -> Char -> String such that makeString n ch1 ch2 returns a string as

4. Write a recursive Haskell function makeString :: Integer -> Char -> Char -> String such that makeString n ch1 ch2 returns a string as follows: When n is positive, the string has length 3n-2 and contains n copies of ch1, each copy separated by two copies of ch2. When n is less than or equal to zero, the string is the empty string. For example, the function has the following behavior: * Main> makeString 5 'a' '!' "a! ! a!! a!! a ! ! a" *Main> makeString 1 'a' '!'. "a" * Main> makeString 10 '6' '#' "6##6##6##6##6##6##6##6##6##6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
