Question: Using Haskell 1. Define your own version of function Data.List.intersperse, called intrsprse :: a-> [a] -> [a]. This function takes an element and a list

Using Haskell

1. Define your own version of function Data.List.intersperse, called intrsprse :: a-> [a] -> [a]. This function takes an element and a list and then puts that element in between each pair of elements in the list (if there are at least two elements in the list). For example,intrsprse 0 [1..5] must return [1,0,2,0,3,0,4,0,5]. Pattern match on the input list and avoid using Data.List.intersperse

2. Define function flat :: [[a]] -> [a] that receives a list of lists and flattens it into a list.For example, if the input is[[1,2],[3,4]]then the output must be[1,2,3,4]. If the input is["hello ", "world"] then the output is"hello world". Pattern match on the input list. You cannot use function concat

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!