Assert{a,z,}
This commit is contained in:
parent
f9017da734
commit
80fb3d1e60
11 changed files with 373 additions and 79 deletions
|
@ -19,7 +19,7 @@ import prolog.logic.unifyLazy
|
|||
* @see [prolog.ast.terms.Variable]
|
||||
* @see [Predicate]
|
||||
*/
|
||||
abstract class Clause(val head: Head, val body: Body) : Resolvent {
|
||||
abstract class Clause(val head: Head, val body: Body) : Term, Resolvent {
|
||||
val functor: Functor = head.functor
|
||||
|
||||
override fun solve(goal: Goal, subs: Substitutions): Answers = sequence {
|
||||
|
@ -70,4 +70,18 @@ abstract class Clause(val head: Head, val body: Body) : Resolvent {
|
|||
}
|
||||
|
||||
override fun toString(): String = if (body is True) head.toString() else "$head :- $body"
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is Clause) return false
|
||||
|
||||
if (head != other.head) return false
|
||||
if (body != other.body) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return super.hashCode()
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue