Use ML Exercise 4 Write a function min3 of type int int in
Use ML
Exercise 4 Write a function min3 of type int * int * int -> int that returns the smallest of three integers.
Solution
Write a function min3 of type int * int * int -> int that returns the smallest of three integers.
fun min3 (a, b, c) =
if a < b andalso a < c
then a
else if b<a andalso b<c
then b
else c;
min3(2, 3, 1);
min3(1, 2, 3);
min3(2, 1, 3);
min3(~1, ~2, ~3);

