fun maxList(L: string list) = if tl(L)=nil (* L is a single element *) then hd(L) (* the single element is the maximum *) else (* assume there are at least 2 elements *) if hd(L)>hd(tl(L)) (* the first element exceeds the second *) then maxList(hd(L)::tl(tl(L))) (* eliminate second element *) else maxList(tl(L)) (* eliminate first element *);