🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #2634

Re: Control Structures

#2634
From: wup
Date: Mon, 06 Apr 1987 15:39
17 lines
887 bytes
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
Technical Details
Message-ID: <1093@rpics.RPI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!rpics!wup
References: <2285@bigburd.PRC.Unisys.COM>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!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