Open hurufu opened 2 months ago
?- phrase(("","";""),X).
X = []
; X = [].
?- setof(X,phrase(("","";""),X),Xs).
Xs = [[]]
; Xs = [[]], unexpected.
?- setof(X,phrase(("";""),X),Xs).
Xs = [[]].
So this clearly is an artefact of inconsistent use of goal expansion. setof/3
detects variables in its goals that should be used for enumeration. Actually, there are none. But when applying goal expansions there are some internal variables.
Currently, there is a cheap hack to circumvent goal expansion:
?- setof(X,t^phrase(("","";""),X),Xs).
Xs = [[]].
This query unexpectedly produces multiple answers:
But the next succeeds deterministically and behaves as expected:
I'm struggling to find a minimal example.