theory

open fun theory(vararg clauseFunctions: S.() -> Any): Theory

Builds a Theory out of clauseFunctions, one per clause: each lambda runs with a fresh newScope as its receiver, and its result is coerced into a Clause via toClause — so it may return an already-built Clause (from it.unibo.tuprolog.core.Scope.factOf/it.unibo.tuprolog.core.Scope.ruleOf/ it.unibo.tuprolog.core.Scope.directiveOf) or a plain it.unibo.tuprolog.core.Struct, as shown in this interface's example. Delegates to TheoryFactory.theoryOf (via theoryFactory) for the actual construction.

Throws

if any of clauseFunctions returns a value that toClause cannot convert.