Arithmetic in Prolog
?- X=2+3, X=5. No
2+3 does not unify with 5
2+3 is an unevaluated expression that is not the same as the literal 5
like x/y was in the 8 queens
?- X is 2+3, X=5. Yes
Force arithmetic evaluation
Previous slide
Next slide
Back to first slide
View graphic version