Talk:Prolog/Math, Functions and Equality

The answer I gave for exercise 2 will not work with variables for either of the first two arguments, except in some trivial cases. For example, using SWI-Prolog, I get: ?- sigma(1,X,45). ERROR: >/2: Arguments are not sufficiently instantiated I believe this can be solved using between, so perhaps later in the book, we could return to this example. --MatrixFrog (talk) 15:03, 10 April 2008 (UTC)

i think the factorial program should be called fac throughout not f f(0,1). f(A,B) :- A > 0, Ax is A - 1, fac(Ax,Bx), B is A * Ax.
 * Absolutely right. Thanks for the contributions so far, btw. risk 15:00, 4 Mar 2005 (UTC)

p(0). ?- p(sin(0)). No. You can't use functions instead of numbers. You have to do: ?- X is sin(0), p(X). Yes.