
common.pl -- Common predicates used in multiple files
Common and utility predicates that may be called from multiple locations.
- author
- - Kyle Marple
- version
- - 20170127
- license
- - BSD-3
predicate(?PredicateStruct:compound, ?Name:atom, ?Args:list) is det- Convert a predicate struct to its components, or vice-versa. Ensure
this doesn't succeed for operators or
not(_)
.
- Arguments:
-
PredicateStruct | - Predicate sturct. |
Name | - Predicate name, in name/arity format. |
Args | - List of predicate args. |
c_rule(?Rule:compound, ?Head:compound, ?Body:list) is det- Convert a rule structure into its head and body, or vice-versa. Note
that if an ID has been attached, it will be paired with the head as
Head = -(RealHead, ID)
. This can be taken advantage of if the head
and ID are simply being copied, but should be used with care.
- Arguments:
-
Rule | - Rule struct. |
Head | - Rule head. |
Body | - Rule body. |
rule(?Rule:compound, ?Head:compound, ?ID:int, ?Body:list) is det- Convert a rule structure with an id into its head, ID and body, or
vice-versa.
- Arguments:
-
Rule | - Rule struct. |
Head | - Rule head. |
ID | - Rule ID. |
Body | - Rule body. |
negate_functor(+Functor:atom, -NegFunctor:atom) is det- Given the functor of a predicate (of the form name/arity), return
the negation.
- Arguments:
-
Functor | - The functor of a predicate. |
NegFunctor | - The negated functor. |
is_dual(+Functor:atom) is semidet- Succeed if a functor contains the prefix '_not_', indicating that
it's a dual.
- Arguments:
-
Functor | - The functor to test. |
is_global_constraint(+Term:callable, -Nth:integer) is semidet- True when this is a predicate implementing the Nth global constraint
join_functor(-Functor, +Name, +Arity) is det
create_unique_functor(+Head:ground, +Counter:int, -NewHead:ground) is det- Create a unique functor by inserting the counter characters just
before the
_Arity
.
- Arguments:
-
Head | - A functor of the form head/arity to form the base of the unique
functor. |
Counter | - Counter to ensure that the functor is unique. Don't reuse it
with the same base. |
DualHead | - The functor for the dual of an individual clause. |
raise_negation(+Goal, -UserGoal) is det
intern_negation(+QIn, -QOut) is det
operator(+Operator:ground, -Specifier:atom, -Priority:int) is det- ASP/Prolog operator table. Original table from the ISO Prolog
standard, with unsupported operators removed. NOTE: Some of the
operators below may not have been implemented yet.
- Arguments:
-
Operator | - An arithmetic operator. |
Specifier | - Defines associativity of operator. |
Priority | - Defines operator priority. |
Re-exported predicates
The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.
split_functor(+Functor:atom, -Name:atom, -Arity:int) is det- Given a predicate functor, return the components. Since the arity is
at the end, we have to be creative to remove it.
- Arguments:
-
Functor | - The predicate functor, of the form Name_Arity. |
Name | - The name with the arity stripped. A list of characters. |
Arity | - The arity of the predicate, or -1 if no arity is
attached. |