Reputation: 13
Why do I get the error "uncaught exception: error(type_error(evaluable,'Jack'/0),(is)/2)" when printing the name.
"test(180)."
info('Mike','Ross',166).
info('Jack','John',180).
test(Name):- info(Y,_,T),T>170, Name is Y.
Upvotes: 1
Views: 67
Reputation: 2422
You don't need the is
at all, your rule should be:
test(Name):- info(Name,_,T),T>170.
then:
?- test(Name).
Name = 'Jack'.
Upvotes: 0
Reputation: 15316
That's because is
is the instruction to perform arithmetic evaluation of the right-hand-side.
In this case, Y
, which is instantiated to Jack
.
However, Jack/0
(Jack
with no arguments) is not an arithmetic function. Hence, an exception.
Upvotes: 1