define a higher order version of the insertion


Define a higher order version of the insertion sort algortihm. That is define functions

insertBy :: Ord b => (a->b) -> a -> [a] -> [a]

inssortBy :: Ord b => (a->b) -> [a] -> [a]

such that inssort f l sorts the list l such that an element x comes before an element y if f x < f y.

Students sit three examinations and their results are represented by the type synonyms:

type Mark = Int

type Result = (Mark, Mark, Mark)

Use inssortBy to answer the following questions. In testing your functions, you may wish to use the list of results, level1,

 

Request for Solution File

Ask an Expert for Answer!!
Application Programming: define a higher order version of the insertion
Reference No:- TGS0207742

Expected delivery within 24 Hours