|Did you know ...||Search Documentation:|
:- use_module(library(solution_sequences)).(can be autoloaded)
If the answers are ground terms, the predicate behaves as the code below, but answers are returned as soon as they become available rather than first computing the complete answer set.
distinct(Goal) :- findall(Goal, Goal, List), list_to_set(List, Set), member(Goal, Set).