subject

Using guarded equations, implement a function myInsert that behaves the same way as the insert function defined in Data. List package. The Data. List. Insert function takes an element and a list and inserts the element into the list at the first position where it is less than or equal to the next element. In particular, if the list is sorted before the call, the result will also be sorted. myInsert : : Ord a â a â [a]â a[a]

a. Explain your nylnsert function definition.

b. Using nylnsert and foldr, implement insertion sort (named mySort).

nySort : : Ord a â a â [a]â a[a]

c. Explain how your nySort works when it is applied as below. Your explanation should be closely related to how foldr works.

nySort [3,1,4,2,5]

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:10
Technician a says that if a valve is open when a piston rises to the very top of a cylinder, the piston may actually strike the valve head and cause serious engine damage. technician b says if the camshaft is located in the engine block, then the engine is called an overhead valve engine, ohv engine, or an in-block camshaft. who is right? a. b only b. both a and b c. a only d. neither a nor b
Answers: 3
question
Computers and Technology, 22.06.2019 14:00
What are procedures that keep a data base current
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Aisha has finished working on a word processing document that contains 15 pages. she has added some special elements in the first three pages, page 9 and 10, and page 15 from the document. she wants to print only these pages to see how they look. which option is the correct way to represent (in the print dialog box) the pages that aisha wants to print
Answers: 3
question
Computers and Technology, 23.06.2019 02:50
There’s only one game mode that stars with the letter ‘e’ in cs: go. which of the options below is it?
Answers: 1
You know the right answer?
Using guarded equations, implement a function myInsert that behaves the same way as the insert funct...
Questions
question
Chemistry, 10.03.2021 17:10
question
Social Studies, 10.03.2021 17:10
question
Mathematics, 10.03.2021 17:10
question
English, 10.03.2021 17:10
Questions on the website: 13722363