Reputation: 184
I have a List like this: [[X,Y],[X],[Y],[X,Y,Z]]
.
Now I want to give every free Variable of X the value "true". Like:
?- assign_val(X,[[X,Y],[X],[Y],[X,Y,Z]], true, R).
R = [[true,Y],[true],[Y],[true,Y,Z]]
How to archive this?
Upvotes: 1
Views: 118
Reputation: 476740
These are not different variables, there is only one variable X
that simply occurs multiple times.
You thus can simply assign true
to X
. The fact that this item in an expression is irrelevant. You can implement this as:
assign_val(X, R, X, R).
But as you see, the R
is not necessary here.
Upvotes: 2