RuleWrapper

abstract class RuleWrapper<C : ExecutionContext>(signature: Signature) : AbstractWrapper<Rule>

A wrapper class for a Prolog-defined Rule, i.e. the clause-based counterpart of it.unibo.tuprolog.solve.primitive.PrimitiveWrapper/it.unibo.tuprolog.solve.function.FunctionWrapper. Used by it.unibo.tuprolog.solve.libraryOf to bundle a library-provided rule (implemented in Prolog itself, rather than in Kotlin) alongside primitives and functions.

Subclasses build implementation declaratively, within scope, by overriding head (the rule head's arguments, whose count must match signature's arity) and body (defaulting to true, i.e. a fact).

Type Parameters

Throws

if head returns a number of arguments different from signature's arity.

Inheritors

Constructors

Link copied to clipboard
constructor(signature: Signature)
constructor(functor: String, arity: Int, vararg: Boolean = false)

Properties

Link copied to clipboard
open val Scope.body: Term

The rule body, in scope; defaults to true, i.e. this wrapper declares a fact.

Link copied to clipboard

Gets this wrapped primitive description Pair formed by signature and wrapped primitive type

Link copied to clipboard

A shorthand to get the signature functor name

Link copied to clipboard
open val Scope.head: List<Term>

The rule head's arguments, in scope; must have as many elements as signature's arity.

Link copied to clipboard
override val implementation: Rule

The wrapped implementation

Link copied to clipboard

Functions

Link copied to clipboard
override fun toString(): String