Question
PLZ HELP!!! This function in Haskell. Please!! permute is to take two lists as parameters: the first is a list of integers that indicates the
PLZ HELP!!! This function in Haskell. Please!!
permute is to take two lists as parameters: the first is a list of integers that indicates the permutation order and the second is an orderable list. The permutation list identifies the order in which the elements are to be reordered. For example, [3,1,2] would permute abc to cab and [2,1,3] would permute it to bac. The values in the permutation list begin with 1, not 0, which means that element 1 is the first in the list (which has an index of 0). Additional rules are
-
The permutation order can include duplicate values. If it does, that element should be repeated
-
If one of the values in the permutation list exceeds the length of the list to be sorted, the function should return the empty list
-
The function does not need to work with infinite lists (i.e., we wont test that case).
Sample calls:
permute [4,1,2] "abcd"
returns "dab"
permute [4,1,4] [1,6..66]
returns [16,1,16]
permute [4,1,2] "abd"
returns ""
Thank you!!
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