4.21 Analysing and Constructing Terms
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Analysing and Constructing Terms
          • functor/3
          • functor/4
          • arg/3
          • =../2
          • compound_name_arity/3
          • compound_name_arguments/3
          • numbervars/3
          • numbervars/4
          • var_number/2
          • term_variables/2
          • nonground/2
          • term_variables/3
          • term_singletons/2
          • is_most_general_term/1
          • copy_term/2
          • copy_term/4
          • copy_term_nat/4
          • Non-logical operations on terms
    • Packages
Availability:built-in
[ISO]term_variables(+Term, -List)
Unify List with a list of variables, each sharing with a unique variable of Term.115This predicate used to be called free_variables/2 . The name term_variables/2 is more widely used. The old predicate is still available from the library library(backcomp). The variables in List are ordered in order of appearance traversing Term depth-first and left-to-right. See also term_variables/3 and nonground/2. For example:
?- term_variables(a(X, b(Y, X), Z), L).
L = [X, Y, Z].