Question: In HASKELL: 1. Define a function remove : : Int -> [Int] -> [Int] that removes the first occurrence (if any) of an integer from
In HASKELL:
1. Define a function remove : : Int -> [Int] -> [Int] that removes the first occurrence (if any) of an integer from a list of integers. For example, remove 1 [5,1,3,1,2] should return [5,3,1,2]
remove : : Int -> [Int] -> [Int]
2. Using remove and the library function minimum :: [Int] -> Int, define a recursive function sort :: [Int] -> [Int] that sorts a list of integers by repeatedly selecting and removing the minimum value. (The removed the element becomes the next value in the sorted list)
sort :: [Int] -> [Int]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
