Cleanup 2
This commit is contained in:
parent
a9bb6e0338
commit
3c938749d0
22 changed files with 299 additions and 110 deletions
|
@ -9,7 +9,7 @@ import prolog.ast.terms.Term
|
|||
import prolog.flags.AppliedCut
|
||||
import prolog.logic.applySubstitution
|
||||
|
||||
class Call(private val goal: Term) : Operator(Atom("call"), null, goal) {
|
||||
class Call(private val goal: Term) : Operator("call", rightOperand = goal) {
|
||||
override fun satisfy(subs: Substitutions): Answers {
|
||||
val appliedGoal = applySubstitution(goal, subs) as Goal
|
||||
return appliedGoal.satisfy(subs)
|
||||
|
@ -19,7 +19,7 @@ class Call(private val goal: Term) : Operator(Atom("call"), null, goal) {
|
|||
/**
|
||||
* Calls [Goal] once, but succeeds, regardless of whether Goal succeeded or not.
|
||||
*/
|
||||
class Ignore(goal: Goal) : Operator(Atom("ignore"), null, goal) {
|
||||
class Ignore(goal: Goal) : Operator("ignore", rightOperand = goal) {
|
||||
private val disjunction = Disjunction(
|
||||
Conjunction(Call(goal), Cut()),
|
||||
True
|
||||
|
|
Reference in a new issue