Question: Haskell Question: Let's have some fun with partial functions. We are going to make a function spreadOut that adds spaces after every character in a

Haskell Question:

Let's have some fun with partial functions. We are going to make a function spreadOut that adds spaces after every character in a string. We'll use three functions, and they must all be partial functions. None of them will include arguments in their code. a) We need a function that adds a space after a character to make a new string.

addSpace :: Char -> [Char]

addSpace = ? b) Let's apply addSpace to every character in a string. This will result in a list of new strings

addSpaces :: [Char] -> [[Char]]

addSpaces = ?

c) Finally, let's make the main function that applies addSpaces, and combines the results into one string. spreadOut :: [Char] -> [Char]

spreadOut = ?

Example output:

>spreadOut "abc"

"a b c "

Thanks

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!