/* maxlist(Xs,N) :- N is the maximum of the list of integers Xs. */ maxlist([X|Xs],M) :- maxlist(Xs,X,M). maxlist([X|Xs],Y,M) :- maximum(X,Y,Y1), maxlist(Xs,Y1,M). maxlist([],M,M). maximum(X,Y,Y) :- X =< Y. maximum(X,Y,X) :- X > Y. % Program 8.9 Finding the maximum of a list of integers