flattenList(A,B):- flattenList(A,[],B). flattenList([],B,B). flattenList([H|T],L,B):- flattenList(H,L1,B), flattenList(T,L,L1). % negation as a failure "\\+/1&