Cleanup 2

This commit is contained in:
Tibo De Peuter 2025-05-09 18:30:18 +02:00
parent a9bb6e0338
commit 3c938749d0
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
22 changed files with 299 additions and 110 deletions

View file

@ -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