I'm kinda new to Prolog. I'm trying to write a function subset(Set, Subset) that determines if Subset is a subset of Set (duh). Also, if the second parameter is not instantiated, it should output every possible subset. Right now, it works when both parameters are instantiated, but when I'm trying to output all subsets, it runs into a problem with member/2. For example:
?- subset([1,2,3], S).
S = [];
S = [1];
S = [1, 1];
S = [1, 1, 1];
...
Here is my code:
% subset/2
% subset(Set, Subset) iff Subset is a subset of Set
subset(_, []).
subset(Set, [H|T]) :-
member(H, Set),
subset(Set, T).
How do I make it so that member doesn't keep picking the first option in Set?