I need to make a program that displays the two maximum numbers in a list using Oz programming language. I have the code for printing the maximum number in a list, but I need the two biggest numbers. Here is what I have so far:
fun {Max L1}
case L1
of nil then 0
[] X|Xr then
if X>{Max Xr} then X
else {Max Xr}
end
end
end
{Browse {Max [1 2 3 4 5 6 7 8 9]}}
This will display the biggest number in the list, but only one and I need the two biggest numbers to display. What do I need to do?