Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!rpics!wup From: wup@rpics.UUCP Newsgroups: comp.lang.prolog Subject: Re: Control Structures Message-ID: <1093@rpics.RPI.EDU> Date: Mon, 6-Apr-87 10:39:30 EST Article-I.D.: rpics.1093 Posted: Mon Apr 6 10:39:30 1987 Date-Received: Thu, 9-Apr-87 00:08:40 EST References: <2285@bigburd.PRC.Unisys.COM> Lines: 17 Keywords: xor Summary: Efficient XOR Concerning xor(G1,G2)... A "logic programming" approach is xor(G1,G2) :- G1,not(G2). xor(G1,G2) :- not(G1),G2. To be efficient in computation, one may want to be somewhat imperative in the "programming", I propose the following... xor(G1,G2) :- not(G1),G2. xor(G1,_) :- G1. This takes into account the possible "side effects" G1 and G2 may have. Peter Y.F. Wu wup@csv.rpi.edu