How do I solve this? I'm trying to make a programm that recieves a list of coordenates (a path) and translates it to directions (Im trying to do it with recursion), the neighbor clause unifies D with the direction needed , examples: test([ (5, 5), (5, 6), (6, 6), (6, 7), (7, 7)],L). would give L=[0,90,0,90], but i get L=[0]. The trace is in the image.[The trace][1]

These are my predicates, my neighbors predicate is without problem.

´test([(_,_)],_).

test([A|P],List):-
	B=(_,_),
	append([B],_,P),     
	neighbor(A,B,Dir), 
	append(List,[Dir],List1), 
	test(P,List1).


  [1]: https://drive.google.com/file/d/0Bxo5hF15vtsLWDB6bGIydm9WbFE/view?usp=sharing