Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started