commonMain.it.unibo.tuprolog.solve.flags.NotableFlag.kt Maven / Gradle / Ivy
package it.unibo.tuprolog.solve.flags
import it.unibo.tuprolog.core.Term
interface NotableFlag {
val name: String
val defaultValue: Term
val admissibleValues: Sequence
fun isAdmissibleValue(value: Term): Boolean =
value in admissibleValues
fun toPair(): Pair =
this to defaultValue
infix fun to(value: Term): Pair =
name to (
value.also {
require(isAdmissibleValue(it)) {
"$value is not an admissible value for flag $name"
}
}
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy