Constructor
new Constraint(pattern, expression)
Creates a new constraint with given pattern and expression.
Parameters:
Name | Type | Description |
---|---|---|
pattern |
OM | an expression which should contain a metavariable (but may not) |
expression |
OM | an expression which must not contain a metavariable |
- Source:
Classes
Methods
applyInstantiation(target)
Applies this constraint, like a substitution, to a single pattern.
Used by instantiate() in ConstraintList.
Parameters:
Name | Type | Description |
---|---|---|
target |
OM | a single pattern |
- Source:
Returns:
a copy of the pattern with any substitutions
breakIntoArgPairs() → {Array.<Constraint>}
Applies only to constraints that match the case where the pattern and
expression are ordinary functions and their 'heads' are equal
(CASES.SIMPLIFICATION). Calling it on other types of constraints
gives undefined behavior.
- Source:
Returns:
a list of constraints (but not a constraint list) which is the
result of 'zipping' the arguments of each function
- Type
- Array.<Constraint>
copy()
- Source:
Returns:
a deep copy
equals(other)
Parameters:
Name | Type | Description |
---|---|---|
other |
Constraint | another Constraint |
- Source:
Returns:
true
if patterns and expressions are structurally equal
OR alpha equivalent, false
otherwise.
getCase(pattern, expression)
Returns the case, as described in the corresponding paper
(and briefly in the case constant declarations)
Parameters:
Name | Type | Description |
---|---|---|
pattern |
OM | |
expression |
OM |
- Source:
isSubstitution()
- Source:
Returns:
true if the pattern is a metavariable, false otherwise.
reEvalCase()
Calls
getCase
again, in case pattern or expression have changes
- Source: