Compatible Doclog docs for library(dcgs)

This commit is contained in:
Adrián Arroyo Calle
2023-01-23 21:03:11 +01:00
parent 5e0e3e2754
commit 7f177c3d03
2 changed files with 64 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/**
Provides predicate dif/2. dif/2 is a constraint that is true only if both of its
Provides predicate `dif/2`. `dif/2` is a constraint that is true only if both of its
arguments are different terms.
*/
@@ -45,18 +45,20 @@ verify_attributes(Var, Value, Goals) :-
%% dif(?X, ?Y).
%
% True iff X and Y are different terms. Unlike \\=/2, dif/2 is more declarative because if X and Y can
% True iff X and Y are different terms. Unlike `\=/2`, `dif/2` is more declarative because if X and Y can
% unify but they're not yet equal, the decision is delayed, and prevents X and Y to become equal later.
% Examples:
%
% ?- dif(a, a).
% false.
% ?- dif(a, b).
% true.
% ?- dif(X, b).
% dif:dif(X,b).
% ?- dif(X, b), X = b.
% false.
% ```
% ?- dif(a, a).
% false.
% ?- dif(a, b).
% true.
% ?- dif(X, b).
% dif:dif(X,b).
% ?- dif(X, b), X = b.
% false.
% ```
dif(X, Y) :-
X \== Y,
( X \= Y -> true