Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is using haskell please only answer if you know haskell Lecture 5: Tail recursion and Datatypes 1. (8 points) Write a function common ::

image text in transcribed
this is using haskell
please only answer if you know haskell
Lecture 5: Tail recursion and Datatypes 1. (8 points) Write a function common :: Eq a => [a] -> [a] -> (a), (a), (a)) where common x y (cp, x'. y'), where cp is the longest common prefix of x and y, and x' and y' are x and y with cp removed. (Le.. x = cp ++ x'.y = cp ++ y', and cp cannot be extended.) Example: if x is (1,3,5,7,9), and yis (1,3,5,8,91, then common xy is (11,3,5), 17,9), (8,91). Restriction: common should call an assistant tail recursive routine that implements a loop. Hint: You'll also want reverse somewhere. Lecture 5: Tail recursion and Datatypes 1. (8 points) Write a function common :: Eq a => [a] -> [a] -> (a), (a), (a)) where common x y (cp, x'. y'), where cp is the longest common prefix of x and y, and x' and y' are x and y with cp removed. (Le.. x = cp ++ x'.y = cp ++ y', and cp cannot be extended.) Example: if x is (1,3,5,7,9), and yis (1,3,5,8,91, then common xy is (11,3,5), 17,9), (8,91). Restriction: common should call an assistant tail recursive routine that implements a loop. Hint: You'll also want reverse somewhere

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

Students also viewed these Databases questions

Question

Write short notes on departmentation.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago