diff options
author | Peter Mikkelsen <peter@pmikkelsen.com> | 2021-06-30 17:48:49 +0000 |
---|---|---|
committer | Peter Mikkelsen <peter@pmikkelsen.com> | 2021-06-30 17:48:49 +0000 |
commit | baea4aa939861fd4efbc71b96f93ba890f01ac40 (patch) | |
tree | 17258014a63d0c0e8de767bcb31914c6d2cb2b1e /stdlib.pl | |
parent | 50f83a91220940042962fdb55d07bb03991f52be (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.pl | 30 |
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. |