ref: be26a1ce93e3ed24e57d2e0916f09252536994cb
dir: /stdlib.pl/
% 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. A , B :- A , B. % Term unification A = A. A \= B :- \+ A = B. % Comparison of terms using the standard order A == B :- compare(=, A, B). A \== B :- \+ A == B. A @< B :- compare(<, A, B). A @=< B :- A == B. A @=< B :- A @< B. A @> B :- compare(>, A, B). A @>= B :- A == B. A @>= B :- A @> B. % List predicates length([], 0). length([_|Tail], Length) :- length(Tail, Length0), Length is Length0 + 1. member(X, [X|_]). member(X, [_|Tail]) :- member(X, Tail). % Standard exceptions instantiation_error :- throw(error(instantiation_error, _)). type_error(ValidType, Culprit) :- throw(error(type_error(ValidType, Culprit), _)). domain_error(ValidDomain, Culprit) :- throw(error(domain_error(ValidDomain, Culprit), _)). existence_error(ObjectType, Culprit) :- throw(error(existence_error(ObjectType, Culprit), _)). permission_error(Operation, PermissionType, Culprit) :- throw(error(permission_error(Operation, PermissionType, Culprit), _)). representation_error(Flag) :- throw(error(representation_error(Flag), _)). evaluation_error(Error) :- throw(error(evaluation_error(Error), _)). resource_error(Resource) :- throw(error(resource_error(Resource), _)). syntax_error(Error) :- throw(error(syntax_error(Error), _)).