The following question should have oneline solutions using m

The following question should have one-line solutions using map, foldr, or foldl. The answer should be in SML. For example, if the problem says \"write a function add2 that takes an int list and returns the same list with 2 added to every element, \"your answer should be: fun add2 x = map (fn a => a + 2) x;

Question: Write a function min of type int list -> int that returns the smallest element of a list of integers. Your function need not behave well if the list is empty.

Solution

Validate with

skeleton of the function would be:

fun min [] = raise Empty

or

The following question should have one-line solutions using map, foldr, or foldl. The answer should be in SML. For example, if the problem says \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site