domains x = integer l = integer* predicates maxlist(l,x) max(x,x,x) clauses max(X,Y,Max) :- X > Y,!, Max = X. max(X,Y,Max) :- Max = Y. maxlist([],0). maxlist([X],X). maxlist([X,Y|List],Max) :- max(X,Y,Max1), maxlist([Max1|List],Max). Output : Goal: maxlist([],M) M=0 1 Solution Goal: maxlist([-1,-2,-3,-4],M) M=-1 1 Solution Goal: maxlist([-8,-1,10,-2,-3,-4],M) M=10 1 Solution