This library collects utilities to reason about terms commonly needed for reasoning about Prolog code. Note that many related facilities can be found in the core as well as other libraries:
- =@=/2, subsumes_term/2, etc.
- comma_list(?CommaList, ?List)
- semicolon_list(?SemicolonList, ?List)
- True if CommaList is a nested term over the ','/2 (';'/2) functor
and List is a list expressing the elements of the conjunction. The
predicate is deterministic if at least CommaList or List is
sufficiently instantiated. If both are partial structures it
enumerates ever growing conjunctions and lists. CommaList may be
left or right associative on input. When generated, the CommaList is
always right associative.
This predicate is typically used to reason about Prolog conjunctions (disjunctions) as many operations are easier on lists than on binary trees over some operator.
- mkconj(A, B, Conj) is det
- mkdisj(A, B, Disj) is det
- Create a conjunction or disjunction from two terms. Reduces on
- pi_head(?PredicateIndicator, ?Goal) is det
- Translate between a PredicateIndicator and a Goal term. The terms may have a module qualification.
- head_name_arity(?Goal, ?Name, ?Arity) is det
- Similar to functor/3, but deals with SWI-Prolog's zero-argument callable terms and avoids creating a non-callable term if Name is not an atom and Arity is zero.
- most_general_goal(+Goal, -General) is det
- General is the most general version of Goal. Goal can be qualified.
- predicate_label(++PI, -Label) is det
- Create a human-readable label for the given predicate indicator.
This notably hides the module qualification from
userand built-in predicates. This predicate is intended for reporting predicate information to the user, for example in the profiler.
- predicate_sort_key(+PI, -Key) is det
- Key is the (module-free) name of the predicate for sorting purposes.