
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

CS181: Programming Languages Vladimir Vacic, Christos Koufogiannakis University of California, Riverside
max(X, Y, Z) :- X >=Y, !, Z = X. max(X, Y, Y).
or
max(X, Y, Z) :- X >= Y, !. max(X, Y, Y) :- X < Y.
fac(1, F, F). fac(N, PP, F) :- N > 1, NPp is N * PP, M is N-1, fac(M, NPp, F).