Question: Write a recursive Haskell function: 3. Write a recursive Haskell function strings Int -> Char -> Char -> [String] such that strings n chl ch2

Write a recursive Haskell function:

Write a recursive Haskell function: 3. Write a recursive Haskell function strings

3. Write a recursive Haskell function strings Int -> Char -> Char -> [String] such that strings n chl ch2 returns a list of n strings, as follows: The first string has length n, and each subsequent string contains one fewer character. . The first (and each subsequent odd-indexed string) contains only the character ch1, and each even-indexed string contains only the charac- ter ch2. If n is negative, the empty list is returned For example, the function has the following behavior: *Main> strings 5 ,a, ,#, ["aaaaa" ,"####" , "aaa" ,"##" ,'' a '' ] *Main> strings 6'S''U' 3. Write a recursive Haskell function strings Int -> Char -> Char -> [String] such that strings n chl ch2 returns a list of n strings, as follows: The first string has length n, and each subsequent string contains one fewer character. . The first (and each subsequent odd-indexed string) contains only the character ch1, and each even-indexed string contains only the charac- ter ch2. If n is negative, the empty list is returned For example, the function has the following behavior: *Main> strings 5 ,a, ,#, ["aaaaa" ,"####" , "aaa" ,"##" ,'' a '' ] *Main> strings 6'S''U

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!