% Improved subset example

subset15(List,Subset) :- ss(15,List,Subset).

ss(0,[],[]).

ss(Sum,[X|List],[X|Subset]) :-     % use X
   Newsum is Sum-X, Newsum >= 0,   % find smaller goal
   ss(Newsum,List,Subset).

ss(Sum,[_|List],Subset) :-         % skip first
   ss(Sum,List,Subset).            % keep same goal
