Question: The question is refers to SML Exercise 15 Write a function select of this type: a list * ('a -bool) -'a list that takes a

The question is refers to SML
Exercise 15 Write a function select of this type: a list * ('a -bool) -'a list that takes a list and a function fas parameters. Your function should apply fto each element of the list and should return a new list containing only those elements of the original list for which freturned true. (The elements of the new list may be given in any order.) For example, evaluating select (01,2,3,4,5,6,7,8,9,101, isPrime) should result in a list like [7,5,3,2]. This is an example of a higher-order function, since it takes another function as a parameter. We will see much more about higher-order functions in Chapter 9. Exercise 15 Write a function select of this type: a list * ('a -bool) -'a list that takes a list and a function fas parameters. Your function should apply fto each element of the list and should return a new list containing only those elements of the original list for which freturned true. (The elements of the new list may be given in any order.) For example, evaluating select (01,2,3,4,5,6,7,8,9,101, isPrime) should result in a list like [7,5,3,2]. This is an example of a higher-order function, since it takes another function as a parameter. We will see much more about higher-order functions in Chapter 9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
