Skip to content

Instantly share code, notes, and snippets.

@joneshf
Last active May 15, 2022 18:03
Show Gist options
  • Save joneshf/6715206 to your computer and use it in GitHub Desktop.
Save joneshf/6715206 to your computer and use it in GitHub Desktop.
:- module(booleans, [and/2, or/2]).
:- op(1000, xfy, and).
:- op(1000, xfy, or).
and(P, Q) :- P , Q.
or(P, Q) :- P ; Q.
➜ prolog swipl
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 6.2.6)
Copyright (c) 1990-2012 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
For help, use ?- help(Topic). or ?- apropos(Word).
?- [booleans].
% booleans compiled into booleans 0.00 sec, 3 clauses
true.
?- true and false.
ERROR: Syntax error: Operator expected
ERROR: true
ERROR: ** here **
ERROR: and false .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment