Solution
flatten_dcg([]) --> []. flatten_dcg([H|T]) --> flatten_dcg(H), flatten_dcg(T). flatten_dcg(X) --> {X\=[]}, {X\=[_|_]}, [X].
Solution
flatten_dcg([]) --> []. flatten_dcg([H|T]) --> flatten_dcg(H), flatten_dcg(T). flatten_dcg(X) --> {X\=[]}, {X\=[_|_]}, [X]. |