I am inclined to agree on this comment, because, IMO, =([X])
is
a derived predicate of arity 1 from =/2 with global variable X.
BTW, my pack pac (clojure) is faithfully aware of such operational semantics as
queries below. SWI-Prolog has library(yall), which seems widely accepted.
So my pac is almost obsolete and deprecated, but I have to keep it because it can represent mutual recursive anonymous predicates, which is used as intermediate language to compile regex into DCG. Unfortunately it is still in my private use.
% ?- pred_partition(=([X]), [1,2,[3],4,[5]], A, B).
%@ X = 3,
%@ A = [1, 2, 4, [5]],
%@ B = [[3]].
% ?- pred_partition(pred([[_]]), [1,2,[3],4,[5]], A, B).
%@ A = [1, 2, 4],
%@ B = [[3], [5]].
% ?- X=3, pred_partition(pred(X, [[X]]), [1,2,[3],4,[5]], A, B).
%@ X = 3,
%@ A = [1, 2, 4, [5]],
%@ B = [[3]].
% ?- X=5, pred_partition(pred(X, [[X]]), [1,2,[3],4,[5]], A, B).
%@ X = 5,
%@ A = [1, 2, [3], 4],
%@ B = [[5]].
% ?- pred_partition(pred(X, [[X]]), [1,2,[3],4,[5]], A, B).
%@ X = 3,
%@ A = [1, 2, 4, [5]],
%@ B = [[3]].
pred_partition(_, [], [], []):-!.
pred_partition(Pred, [H|T], I, [H|E]):- call(Pred, H), !,
pred_partition(Pred, T, I, E).
pred_partition(Pred, [H|T], [H|I], E):- pred_partition(Pred, T, I, E).