The following functions will be used in further work without comment.
val europe = [("Andorra",450.0,65780.0,760000000.0), ("Austria",83850.0,7986664.0,139300000000.0), ("Belgium",30510.0,10081880.0,181500000000.0), ("Denmark",43070.0,5199437.0,103000000000.0), ("Estonia",45100.0,1625399.0,10400000000.0), ("Finland",337030.0,5085206.0,81800000000.0), ("France",547030.0,58109160.0,1080100000000.0), ("Germany",356910.0,81337541.0,1452200000000.0), ("Greece",131940.0,10647511.0,93700000000.0), ("Ireland",70280.0,3550448.0,49800000000.0), ("Italy",301230.0,58261971.0,998900000000.0), ("Latvia",64100.0,2762899.0,12300000000.0), ("Liechtenstein",160.0,30654.0,630000000.0), ("Lithuania",65200.0,3876396.0,13500000000.0), ("Luxembourg",2586.0,404660.0,9200000000.0), ("Malta",320.0,369609.0,3900000000.0), ("Monaco",1.0,31515.0,558000000.0), ("Netherlands",37330.0,15452903.0,275800000000.0), ("Norway",324220.0,4330951.0,95700000000.0), ("Portugal",92080.0,10562388.0,107300000000.0), ("San Marino",60.0,24313.0,380000000.0), ("Spain",504750.0,39404348.0,515800000000.0), ("Sweden",449964.0,8821759.0,163100000000.0), ("Switzerland",41290.0,7084984.0,148400000000.0), ("United Kingdom",244820.0,58295119.0,1045200000000.0) ]; fun name(x,_,_,_) = x; fun area(_,x,_,_) = x; fun pop (_,_,x,_) = x; fun gdp (_,_,_,x) = x;The figures are area in sq km, population, and GDP in US dollars.
fun sort (f:'a -> real) nil = nil | sort f (h::t) = let fun insert x nil = [x] | insert x (h::t) = if f x > f h then x::h::t else h::insert x t in insert h (sort f t) end;Use this function to determine the largest European country in terms of: