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

@ -23,7 +23,7 @@ import prolog.logic.unifyLazy
* return, unifying Cont with a Goal that represents the continuation after shift.
*/
class Reset(private val goal: Goal, private val ball: Term, private val cont: Term) :
Structure(Atom("reset"), listOf(goal, ball, cont)) {
Structure("reset", goal, ball, cont) {
override fun satisfy(subs: Substitutions): Answers = sequence {
goal.satisfy(subs).forEach { goalResult ->
goalResult.fold(
@ -63,7 +63,7 @@ class Reset(private val goal: Goal, private val ball: Term, private val cont: Te
/**
* Variables that have been bound during the procedure called by reset/3 stay bound after a shift/1:
*/
class Shift(private val ball: Term) : Structure(Atom("shift"), listOf(ball)) {
class Shift(private val ball: Term) : Structure("shift", ball) {
override fun satisfy(subs: Substitutions): Answers = sequence {
val shift = AppliedShift(
subs = subs,