test: Cut not_equal
This commit is contained in:
parent
229a8bbc3c
commit
2fcab52f65
7 changed files with 75 additions and 18 deletions
|
@ -7,7 +7,7 @@ import prolog.ast.terms.Functor
|
|||
import prolog.ast.terms.Goal
|
||||
import prolog.ast.terms.Head
|
||||
import prolog.builtins.True
|
||||
import prolog.exceptions.AppliedCut
|
||||
import prolog.flags.AppliedCut
|
||||
import prolog.logic.unifyLazy
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,11 @@ abstract class Clause(private val head: Head, private val body: Body) : Resolven
|
|||
onFailure = { error ->
|
||||
if (error is AppliedCut) {
|
||||
// Find single solution and return immediately
|
||||
yield(Result.failure(AppliedCut(newHeadSubs + error.subs)))
|
||||
if (error.subs != null) {
|
||||
yield(Result.failure(AppliedCut(newHeadSubs + error.subs)))
|
||||
} else {
|
||||
yield(Result.failure(AppliedCut()))
|
||||
}
|
||||
return@sequence
|
||||
} else {
|
||||
yield(Result.failure(error))
|
||||
|
|
Reference in a new issue