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;This particular version of sort allows us to specify the quantity to sort on. The quantity must be a real number - for example population or GDP.
Enter the following lines in sequence
sort area europe; hd it; name it;
val bigArea = name(hd(sort area europe));