0
votes

I'm trying to use the mod operator in gprolog 1.3 and keep getting errors. Here's an example predicate I made to demonstrate the problem:

test(N) :- N mod 10.

When I query test(2). I get "uncaught exception: error(existence_error(procedure,(mod)/2,test/1)". Am I doing something wrong?

2
get gprolog 1.4.2! It is has more complete arithmetics than 1.3! - false
Tried 1.4.2, still got the same error :( - amandawulf

2 Answers

3
votes

Try this:

test(N,X) :- X is N mod 10.
0
votes

This does not make sense. In prolog, everything is like a rule. The head and the tail should be a statement. I don't remember the syntax clearly, but it should be like

mod10Is2(N) :- N mod 10 = 2