Reputation: 610
how can I mark all the unbound variable to number? For example :
exists(_G1234...all(_G2345...
changes to
exists(1 ... all(2...
("..."menas code which not important)
(exists and all are compound type)
Upvotes: 2
Views: 487
Reputation: 22585
I would use term_variables/2 to get the unbound variables and then number them.
index_mark_unbound(Term):-
term_variables(Term, Vars),
range(Vars, 1).
range([], _).
range([Value|Vars], Value):-
succ(Value, NValue),
range(Vars, NValue).
Test:
?- Term=exists(A,all(_,B),A), index_mark_unbound(Term).
Term = exists(1, all(2, 3), 1),
A = 1,
B = 3
Upvotes: 1