Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Plz help!!! Write function in haskell. Thank you!! reorder is a single function that can either reorder or sort. Since the two functions need different

Plz help!!! Write function in haskell. Thank you!!

reorder is a single function that can either reorder or sort. Since the two functions need different types of parameters, you are to define a new data type that can have either one. Thus, reorder is to take two parameters: the first is to be a new data type called Choose and the second is an orderable list. Choose is to be defined as either a Sort or a Permute. Sort is a single character and Permute is a list of integers. If Choose is a Sort, the orderable list is to be processed in the same way as it would be processed with the Sort value passed to osort. If Choose is a Permute, the list is to processed as if the two lists were passed to permute. That is,

reorder (Sort 'f') [9,3,6,2] should produce the same result as osort 'f' [9,3,6,2]

and

reorder (Permute [2,1,3]) [9,3,6,2] the same as permute [2,1,3] [9,3,6,2]

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

Explain how cultural differences affect business communication.

Answered: 1 week ago

Question

List and explain the goals of business communication.

Answered: 1 week ago