summaryrefslogtreecommitdiff
path: root/stdlib.pl
diff options
context:
space:
mode:
authorPeter Mikkelsen <peter@pmikkelsen.com>2021-06-30 17:48:49 +0000
committerPeter Mikkelsen <peter@pmikkelsen.com>2021-06-30 17:48:49 +0000
commitbaea4aa939861fd4efbc71b96f93ba890f01ac40 (patch)
tree17258014a63d0c0e8de767bcb31914c6d2cb2b1e /stdlib.pl
parent50f83a91220940042962fdb55d07bb03991f52be (diff)
Add a standard library with the "builtins" that doesn't really need to be actual builtins
Diffstat (limited to 'stdlib.pl')
-rw-r--r--stdlib.pl30
1 files changed, 30 insertions, 0 deletions
diff --git a/stdlib.pl b/stdlib.pl
new file mode 100644
index 0000000..c53cf78
--- /dev/null
+++ b/stdlib.pl
@@ -0,0 +1,30 @@
+% Logic and control predicates
+\+ Goal :- call(Goal), !, fail.
+\+ Goal.
+
+once(Goal) :-
+ call(Goal),
+ !.
+
+repeat :- true ; repeat.
+
+% Control structures.
+true.
+
+If -> Then :-
+ If, !, Then.
+
+If -> Then ; _ :-
+ If, !, Then.
+_ -> _ ; Else :-
+ !, Else.
+If ; _ :-
+ If.
+_ ; Else :-
+ Else.
+
+% Term unification
+A = A.
+
+A \= B :-
+ \+ A = B.