I am trying to filter a list of lists in prolog such that [[a,b,c],[],[d],[e,f]] gives [[a,b,c],[e,f]], my filter function should omit the elements of length less than two, The code I tried is as follows,
omitunwanted([],_) :- [].
omitunwanted([List|L1],[H|T]) :-
( length(List,0)->
omitunwanted(L1,[H|T])
; length(List,1)->
omitunwanted(L1,[H|T])
; append(List,[],H),
omitunwanted(L1,T)
).
It returns the output [[a,b,c],[e,f]|_G1622] for the input [[a,b,c],[],[d],[e,f]] . I cant figure out what I am doing wrong