let matrix m = let remove_first_two = function | (h1 :: h2 :: t) -> List.rev t | _ -> raise (Invalid_argument "invalid list") in let remove_last = function | h :: t -> List.rev t |_ -> raise (Invalid_argument "invalid list") in remove_last (remove_first_two m)