Logtalk reference manual
Built-in method: expand_term/2

expand_term/2

Description

expand_term(Term, Expansion)

Expands a term. The most common use is to expand a grammar rule into a clause. Users may override the default Logtalk grammar rule translator by defining clauses for the predicate term_expansion/2.

The expansion works as follows: if the first argument is a variable, then it is unified with the second argument; if the first argument is not a variable and clauses for the term_expansion/2 predicate are within scope, then this predicate is called to provide an expansion that is then unified with the second argument; if the term_expansion/2 predicate is not used and the first argument is a compound term with functor -->/2 then the default Logtalk grammar rule translator is used, with the resulting clause being unified with the second argument; when the translator is not used, the two arguments are unified.

This built-in method may be used to expand a grammar rule into a clause for use with the built-in database methods.

Template and modes

expand_term(?term, ?term)

Errors

(none)

Examples

(none)