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

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

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!