commonMain.it.unibo.tuprolog.solve.function.FunctionWrapper.kt Maven / Gradle / Ivy
package it.unibo.tuprolog.solve.function
import it.unibo.tuprolog.solve.AbstractWrapper
import it.unibo.tuprolog.solve.ExecutionContext
import it.unibo.tuprolog.solve.Signature
/**
* A class wrapping a [PrologFunction] implementation
*
* @author Enrico
*/
abstract class FunctionWrapper : AbstractWrapper {
constructor(signature: Signature) : super(signature)
constructor(name: String, arity: Int, vararg: Boolean = false) : super(name, arity, vararg)
/** The function expressing the implementation of the PrologFunction, without any check for application to correct signature */
protected abstract fun uncheckedImplementation(request: Compute.Request): Compute.Response
/** Checked PrologFunction implementation */
@Suppress("UNCHECKED_CAST")
final override val wrappedImplementation: PrologFunction by lazy {
functionOf(signature, ::uncheckedImplementation as PrologFunction)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy