fix: Evaluation
This commit is contained in:
parent
d702b9b081
commit
1acd1cfb67
17 changed files with 189 additions and 120 deletions
|
@ -21,18 +21,18 @@ data class Variable(val name: String) : Term {
|
|||
alias = Optional.empty()
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return when {
|
||||
alias.isPresent -> "$name = ${alias.get()}"
|
||||
else -> name
|
||||
override fun compareTo(other: Term): Int {
|
||||
return when (other) {
|
||||
is Variable -> name.compareTo(other.name)
|
||||
// Variables are always less than atoms
|
||||
else -> -1
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return if (alias.isPresent) {
|
||||
alias.get() == other
|
||||
} else {
|
||||
name == other.toString()
|
||||
override fun toString(): String {
|
||||
return when {
|
||||
alias.isPresent -> "$name: ${alias.get()}"
|
||||
else -> name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue