Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

language: Haskell For this question you will implement (under specific constraints) a recursive function in Haskell that takes a list of characters as an argument

language: Haskell

image text in transcribed

For this question you will implement (under specific constraints) a recursive function in Haskell that takes a list of characters as an argument and returns a list that contains only every third element from the argument list in the same order. As a clarifying example, this function, when passed the argument list "ABCDEFGHIJKLMNO", should return the list "CFILO". It should also be noted that your function must work (i.e., not terminate with an error) even if the number of elements in the argument list is less than three 4. You may NOT use the !l operator to complete this question, and you may NOT use any function that you haven't written here (i.e., you may NOT use any built-in functions, but you may use other functions if you write them yourself). a. Write this function (including a type declaration) by first writing a selector function (for retrieving the third element of a list) and then having your recursive function call your 4.0 marks] selector function as required. b. Write this function (including a type declaration) without selector functions (even if you 4.0 marks] wrote them yourself), using only pattern matching. For this question you will implement (under specific constraints) a recursive function in Haskell that takes a list of characters as an argument and returns a list that contains only every third element from the argument list in the same order. As a clarifying example, this function, when passed the argument list "ABCDEFGHIJKLMNO", should return the list "CFILO". It should also be noted that your function must work (i.e., not terminate with an error) even if the number of elements in the argument list is less than three 4. You may NOT use the !l operator to complete this question, and you may NOT use any function that you haven't written here (i.e., you may NOT use any built-in functions, but you may use other functions if you write them yourself). a. Write this function (including a type declaration) by first writing a selector function (for retrieving the third element of a list) and then having your recursive function call your 4.0 marks] selector function as required. b. Write this function (including a type declaration) without selector functions (even if you 4.0 marks] wrote them yourself), using only pattern matching

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

Step: 3

blur-text-image

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

Why is a job analysis important?

Answered: 1 week ago

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago