Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!yale!quasi-eli!cs.yale.edu!newsbase!duchier From: duchier@cs.yale.edu (Denys Duchier) Newsgroups: comp.lang.prolog Subject: Re: not(X=Y) and side effects Message-ID: Date: 12 Dec 90 20:43:06 GMT References: <5398@rex.cs.tulane.edu> Sender: news@cs.yale.edu Reply-To: duchier-denys@cs.yale.edu Organization: Computer Science, Yale University, New Haven, CT 06520-2158 Lines: 14 Nntp-Posting-Host: albania.ai.cs.yale.edu In-reply-to: feldman@rex.cs.tulane.edu's message of 12 Dec 90 19:15:54 GMT In article <5398@rex.cs.tulane.edu> feldman@rex.cs.tulane.edu (Damon Feldman) writes: > I was writing a small prolog program, and I had use for the following > predicate: > > notequal(X,Y) :- nonvar(X),nonvar(Y),X=Y,!,fail. > notequal(X,_) :- var(X),!,fail. > notequal(_,Y) :- var(Y),!,fail. > notequal(_,_). Why not just: notequal(X,Y) :- nonvar(X),nonvar(Y),X\=Y. --Denys