%% transp(T, M) :- T is the transposition of the matrix M (not ready)
heads([], M) :- flatten(M, F), atom(F).
heads([H|Hs], [[H|_]|T]) :- heads(Hs, T).

tails([], M) :- flatten(M, F), atom(F).
tails([T|Ts], [[_|T]|S]) :- tails(Ts, S).

transp([], []).
transp([H|T], M) :- heads(H, M), tails(U, M), transp(T, U).

%% fix 1
h([H|Hs], [[H|_]|T]) :- h(Hs, T).