prolog
fun <R> prolog(unificator: Unificator = Solver.prolog.defaultUnificator, function: LogicProgrammingScope.() -> R): R
Shorthand for logicProgramming defaulting its solverFactory argument to Solver.prolog, the classic, ISO-standard SLD-NF resolution engine (:solve-classic). This is the DSL's main entry point for everyday use:
prolog {
staticKb(
fact { "parent"("abraham", "isaac") },
rule { "ancestor"("X", "Y") `if` "parent"("X", "Y") },
)
for (solution in solve("ancestor"("abraham", "X"))) {
if (solution is it.unibo.tuprolog.solve.Solution.Yes) {
println(solution.substitution["X"])
}
}
}Content copied to clipboard
Requires a concrete solver implementation (e.g. :solve-classic) on the classpath, since Solver.prolog resolves to it lazily at runtime.
Parameters
unificator
the Unificator shared by the scope's term-building helpers and its default solver.