Showing posts with label prolog. Show all posts
Showing posts with label prolog. Show all posts

Thursday, May 08, 2008

Not Equal In Prolog

After consulting with this website, actually connected with pop11. :)

The following interaction from SWI-Prolog when consulting j.pl. Use similar code to make sure sally is not her own sibling.

% c:/j.pl compiled 0.00 sec, -292 bytes
11 ?- listing.


myneq(A, B) :-
A\=B.

Yes
12 ?- myneq(a, a).

No
13 ?- myneq(a, b).

Yes