///Given a length, width and height, computes the volume as a float
let cubeVolume (x,y,z) = float x * y * z
///goes through a list of tuples and creates a list of their volumes
let rec volumelist list =
if list = []
then []
else
let hd :: tl = list
// compute volume of head values and append to list
cubeVolume(hd) :: volumelist tl
///goes through a list of volumes and finds the max volume
let maxVolume list =
let rec loop max = function
| [] -> max
// if hd volume is greater than max, send hd as new max
// otherise continue with previous max
| hd :: tl -> loop (if hd > max then hd else max) tl
loop 0.0 list
///calls the functions above on a list to correctly get the max cube volume
let maxCubeVolume list = maxVolume (volumelist (list))
let tupleList = [(2.1, 3.4, 1.8); (4.7, 2.8, 3.2); (0.9, 6.1, 1.0); (3.2, 5.4, 9.9)]
let result = maxCubeVolume tupleList
//printfn "%A" result