There is a Matrix transpose function:
let rec transpose = function | (_::_)::_ as M -> List.map List.head M :: transpose (List.map Li
This maps head over the lists to extract the first column and uses that to form the first row prepended to the result of transposing the remaining columns.
head