Article View: comp.lang.prolog
Article #2624Re: Prolog control structures
From: debray
Date: Thu, 02 Apr 1987 04:56
Date: Thu, 02 Apr 1987 04:56
19 lines
1181 bytes
1181 bytes
I'd proposed the following solutions to Chomicki's problems:
> Assuming no side effects, the following works on most Prologs:
>
> (1) xor(G1,G2) :- not(not(call(G1))) -> call(G1) ; call(G2).
>
> (2) P :- ( not(not( (A,B) )) -> (A -> B) ; (A, B) ), C, D.
>
The following simplifications should now be obvious:
(1) xor(X,Y) :- not(call(X)) -> call(Y) ; call(X).
(2) P :- ( not( (A -> B) ) -> (A, B) ; (A -> B) ), C, D.
--
Saumya Debray CS Department, University of Arizona, Tucson
internet: debray@arizona.edu
uucp: {allegra, cmcl2, ihnp4} !arizona!debray
Technical Details
Message-ID:
<1609@megaron.arizona.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!nbires!hao!noao!arizona!debrayReferences:
<10588@topaz.RUTGERS.EDU> <1608@megaron.arizona.edu>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!nbires!hao!noao!arizona!debray From: debray@arizona.UUCP Newsgroups: comp.lang.prolog Subject: Re: Prolog control structures Message-ID: <1609@megaron.arizona.edu> Date: Wed, 1-Apr-87 23:56:30 EST Article-I.D.: megaron.1609 Posted: Wed Apr 1 23:56:30 1987 Date-Received: Sat, 4-Apr-87 19:48:18 EST References: <10588@topaz.RUTGERS.EDU> <1608@megaron.arizona.edu> Organization: U of Arizona CS Dept, Tucson Lines: 19 Summary: even simpler solutions