Quiz 8 - Prolog Selection - SOLUTION

CS 152 - Spring 2008

SOLUTION

Here is an example solution. Note that there are other possible ways to accomplish the same result.

largest([X], X).
largest([L|Ls], N) :- largest(Ls, N), N > L.
largest([L|Ls], L) :- largest(Ls, N), L >= N.

Alternatively, you could use the operators @> and @>= instead of > and >=.