I have this portion of code as base case in a recursive predicate.
riduci_lista_valori([[V, N]],m_var,Lr):-
member(V, m_var),
Lr =[N].
The problem is that when I perform my query it does not unify correctly the arguments of the predicate with its parameters.
Given the code, my query is: riduci_lista_valori([[a, 5]], [c,e], F).
And I expect Prolog to return F = [5]
.
Debugging the code seems it doesn't recognize properly the arguments because it does not unify like: V = a
, N = 5
m_var = [c,e]
but it gives:
1 = [[a, 5]]
and 2 = [c, e]
.
Whereas if I prompt : [[V, N]] = [[a,5]].
it makes the correct unification:
V = a
, N = 5
.
What am I doing wrong? thank you!