1%-----------------------------------------------------------------------------% 2% vim: ft=prolog ts=4 sw=4 et wm=0 tw=0 3%-----------------------------------------------------------------------------% 4:-module(hellgates, [ and/2, op(1000, xfy, and), 5 or/2, op(1100, xfy, or), 6 nand/2, op(1100, xfy, nand), 7 andn/2, op(1100, xfy, andn), 8 nor/2, op(1100, xfy, nor), 9 orn/2, op(1100, xfy, orn), 10 xor/2, op(1100, xfy, xor), 11 orx/2, op(1100, xfy, orx), 12 xnor/2, op(1100, xfy, xnor), 13 norx/2, op(1100, xfy, norx), 14 xorn/2, op(1100, xfy, xorn), 15 ornx/2, op(1100, xfy, ornx) ]).
44:- multifile license:license/3. 45licencelicense(wtfpl, lgpl, 46 [ comment('Do What The Fuck You Want To Public License'), 47 url('http://www.wtfpl.net/txt/copying')]). 48:- license(wtfpl). 49 50% Reminiscent of pascal? Why use the mundane ',' and ';' when this 51% module provides the longer (and more descriptive) 'and' and 'or'?
57X and Y :- , .
63X or Y :- ; .
1=1 nand 1=1. %% false 1=1 nand 1=2. %% true 1=2 nand 1=1. %% true 1=2 nand 1=2. %% true
But what happens when something is not fully instantiated?
T=1 nand T=2. %% true T=1 nand T=1. %% false
84X nand Y :- \+ (, ).
T=1 andn T=2. %% false
94X andn Y :- once( (\+ X) ; (\+ Y)).
99X nor Y :- \+ ( ; ).
104X orn Y :- \+ , \+ .
109X xor Y :- once((X ; Y)), \+ (,).
114X orx Y :- once((X ; Y)), once((\+ X ; \+ Y)).
119X xnor Y :- \+ (X xor Y).
124X norx Y :- once((X, Y) ; \+(X ; Y)).
129X xorn Y :- \+ ( \+ , \+ ).
134X ornx Y :- once(X ; Y)
Gates of Hell
An expansion of the Evil Prolog, this module allows you to follow the example of so many heroes such as Orpheus, Aeneas and Odysseus: denounce the garish light of day and use these Gates for a trip in the netherworld!
This module allows you to use more sophisticated binary operators than the trivial ',' and ';' hence enriching your prolog program. Combined with the closed-world hypothesis and unification issues, this module will definitely boost your reasoning powers unless you abandon all hope of understanding your program