Higher-order functions in ML Higher-order functions A first-order function is one whose parameters and result are all "data" A second-order function has one or…