logicProgramming
fun <R> logicProgramming(solverFactory: SolverFactory, unificator: Unificator = solverFactory.defaultUnificator, function: LogicProgrammingScope.() -> R): R
Entry point of the resolution-aware Prolog DSL: builds a fresh LogicProgrammingScope backed by a it.unibo.tuprolog.solve.MutableSolver obtained from solverFactory (see LogicProgrammingScopeWithResolution.defaultSolver), and runs function against it as the receiver. Everything built or asserted inside function (facts, rules, queries via solve/staticKb/dynamicKb) shares that one scope and that one underlying solver.
logicProgramming(SolverFactory) {
staticKb(fact { "parent"("abraham", "isaac") })
solve("parent"("abraham", "X")).forEach { println(it) }
}Content copied to clipboard
Parameters
solverFactory
the SolverFactory used both to build the scope's default solver and, unless overridden, as the source of unificator.
unificator
the Unificator shared by the scope's term-building helpers and its default solver; must be compatible with solverFactory (see LogicProgrammingScope.of).