Using freeze/2
test_cut(X) :-
freeze(L, (X = 1 ; X = 2)),
test_cut_list(L).
Then, these variations both have the same issue…
test_cut_list([]) :- !.
and
test_cut_list(L) :-
(L = [] -> true).
… both chop off the 2nd alternative, producing only:
?- test_cut(X).
X = 1.
… whereas either of these 2 predicates…
test_cut_list([]).
and
test_cut_list(L) :-
(L = [] *-> true).
… produce the 2 expected solutions:
?- test_cut(X).
X = 1 ;
X = 2.
Isn’t this a bug in freeze/2? The logic flow in test_cut_list
seems to be strangely affecting the X = 2
freeze
path.