I want to make prolog returning me all possible sublists of given list so I wrote:
subSet(L,S):- append(_,L2,L),append(S,_,L2).
In that way I get result like:
Out = [] ;
Out = [a] ;
Out = [a, b] ;
Out = [a, b, c] ;
Out = [] ;
Out = [b] ;
Out = [b, c] ;
Out = [] ;
Out = [c] ;
Out = [] ;
What I have to do to get rid of repeating empty list?
Rule out that you are describing the empty list at all and add it manually once.
Nevertheless, expressing subsequences is often better done with DCGs. See the first definition in this response. Using
append/3might work, but leads to code that is quite difficult to read.