term_variables/2
[ISO]term_variables(
+Term,
-Variables)
since release 4.3
True if Variables is the list of variables occurring in Term,
without duplicates, in first occurrence order.
type_error
| ?- term_variables(f(A, B, A), Vs). Vs = [A,B] ? yes | ?- term_variables(f(a, b, a), Vs). Vs = [] ? yes | ?- T=[A,B|T], term_variables(f(C,T), Vs). T = [A,B,A,B,A,B,A,B,A,B|...], Vs = [C,A,B] ? yes