Skip to content

bagof/3 same problem as setof/3 #3187

@UWN

Description

@UWN
?- L=[_,_,_,_], bagof(t,permutation(L,L),"tttttt").
   false, unexpected.
   L = [_A,_A,_A,_A].

And in any case, the simplest way to implement setof/3 is:

setof(Templ, G_0, Ts) :-
   can_be(list, Ts),
   bagof(Templ, G_0, TsB),
   sort(TsB, Ts).

It is possible to implement setof/3 with a single sort/2. But for the moment, correctness has priority.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions