I'm having some trouble writing a relatively simple predicate in Prolog. This predicate is supposed to receive two arguments in the format Hours:Minutes, calculate the difference between the two and check if that value is greater or equal to 40 minutes.
Here's what I have so far:
time(Time1, Time2):-
X:Y =:= Time1, A:B =:= Time2, calculate_time(X, Y, A, B).
calculate_time(X, Y, A, B):-
Y - X =:= 0,
B - A >= 40, !.
calculate_time(X, Y, A, B):-
Y - X > 0.
This, as you can imagine, is giving an error, namely:
?- time(10:00, 10:55).
ERROR at clause 1 of user:time/2 !!
INSTANTIATION ERROR- in arithmetic: expected bound value
So, as far as I can understand, he thinks that he's been given four arguments. Why is he reacting this way? Also, at the beginning of the file, I have the following commands:
:-op(500,xfy,:).
:-op(600,xfy,/).
This predicate is supposed to be a part of a larger program, so these two lines need to stay in the file. I'm not using any module and I'm using YAP.
Any help would be appreciated!