Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions