% From the book % PROLOG PROGRAMMING IN DEPTH % by Michael A. Covington, Donald Nute, and Andre Vellino % (Prentice Hall, 1997). % Copyright 1997 Prentice-Hall, Inc. % For educational use only % File FACTORI2.PL % Another way to compute factorials factorial(N,FactN) :- fact_iter(N,FactN,0,1). fact_iter(N,FactN,N,FactN) :- !. fact_iter(N,FactN,I,J) :- I