For an input like extract_column([[1,2], [3, 4], [5,6]], 0, X)., I'd like to see the result as [1,3,5]. I'm not sure if my base case is correct or how to proceed with the recursive logic.
The point is to get the Ith element of the header (list), append it to the result list R and recursively apply that logic to all of the lists inside the big list.
extract_column([], [R1]). extract_column([H|T], I, [R]) :- extract_column([T], I, [R1]), nth0(I, [H], num1), append([R], num1, R1).