And here's an implementation of exercise 24 with refs:
letmin_and_maxlst=(* We get the first element as the base for min and max
We are assured that the list is not empty, but else it would throw an exception *)letmin=ref(List.hd_exnlst)inletmax=ref(List.hd_exnlst)inList.iter~f:(funelem->ifelem<!minthenmin:=elem;ifelem>!maxthenmax:=elem)lst;!min,!max;;
And here's an implementation of exercise 24 with refs:
nice, thank you very much!!