Question: Question 1 Write a function called extremes in Ocaml / F# , which accepts two parameters: a function ( that acts as a filter )

Question 1
Write a function called extremes in Ocaml/F#, which accepts two parameters: a function (that acts as a "filter") and a list of integers. The function should resolve to a pair of values (technically; a tuple) containing both the largest and
smallest values in the list, which are also "accepted" by the predicate.
NOTE: Use a "purely" functional form. E.g., Use Pattern matching where applicable and no "mutable" types.
Example of the usage: Given the following function invocation of extremes:
let r= extremes fun xx&2=0
The value of r would be (4,8)
(Of the list values divisible by 2,4 is the smallest, and 8 is the largest.)
Question 1 Write a function called extremes in

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!