
variables.pl -- Variable storage and access
Predicates related to storing, accessing and modifying variables.
- author
- - Kyle Marple
- version
- - 20170515
- license
- - BSD-3
is_var(@Term) is semidet
is_var(@Term, Name) is semidet- Test an entry to see if it's a variable (the first non-underscore is
an upper-case letter.
- Arguments:
-
Term | - is the term to be tested. |
body_vars(+Head:compound, +Body:list, -BodyVars:list) is det- Get the body variables (variables used in the body but not in the
head) for a clause.
var_list(+N:int, -Vars:list) is det- Get a list of N variables, each of which is different. Basically,
just append a counter to '_X'. The '_' prefix ensures they don't
overlap with any existing variables in a rule.
- Arguments:
-
N | - The size of the list to return. |
Vars | - output list. |
revar(+Term, -VarTerm, -Bindings) is det- If Term is a term that contains atoms using variable syntax
([A-Z].*), VarTerm is a copy of Term with all such atoms replaced by
variables. In addition this performs the following rewrites:
- A term N/D is translated into
rat(N,D)
- An atom N/D is translated into
rat(N,D)
- A quoted atom is translated into its unquoted equivalent
- Arguments:
-
Bindings | - is a list Name=Var that contains the variable names. |