I need to write a program that return an element from a list, using a specified index.
We have a list of the English alphabet X = [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]
Starting at 0, I have to return, for example, the number with index 13, so the letter 'n', how do you return an element from a list with a specified index?
Here's what I have worked in, but still doesn't run properly.
position(0, 0, [], a).
position(X, I, [H1|T1], _):-
position(X, I1, T1, H1),
I = I1 + 1.