flatten([],[]).
flatten([H|A],[H|A]) :- flatten(A,B).
flatten([L|A],Z) :- is_list(L), !, append(L,A,X), flatten(X,Z).
