I'm trying to write a clause in Prolog that takes in a list and returns predicates of edges. For example:
?- listpairs([1, 2, 3], X, Y).
X = 1
Y = 2;
X = 2
Y = 3;
This is what I've tried so far and haven't been getting anywhere.
listpairs([H], H, H).
listpairs([H1,H2|T], X, Y) :-
X is H1,
Y is H2,
listpairs([H2|T], X, Y).
I would appreciate it if someone could help.