Package-level declarations

Types

Link copied to clipboard
abstract class AbstractWrapper<out Wrapped>(val signature: Signature)

Signature to Wrapped type, abstract wrapper class

Link copied to clipboard
interface Durable

A type for entities bound to a maximum execution duration, e.g. an ExecutionContext or a it.unibo.tuprolog.solve.primitive.Solve.Request, used to enforce it.unibo.tuprolog.solve.SolveOptions.timeout across a resolution and its nested requests.

Link copied to clipboard

An interface representing the Solver execution context, containing important information that determines its behaviour.

Link copied to clipboard

Base type for all entities which must be aware of the current state of a solver

Link copied to clipboard
data class JsClassName(val module: String, val qualifiedName: String)

A parsed reference to a JS value (e.g. a SolverFactory object instance) reachable as require(module) followed by the dotted qualifiedName path, as used by the JS actual lookups of classicSolverFactory() and friends.

Link copied to clipboard
interface MutableSolver : Solver

General type for mutable logic Solvers. MutableSolvers differ from Solvers in that they expose public methods for letting clients affect the state of the solver -- e.g. affecting the KB -- while no resolution process is ongoing.

Link copied to clipboard
data class Signature(val name: String, val arity: Int, val vararg: Boolean = false) : TermConvertible

The signature of a query Struct or a Primitive

Link copied to clipboard
sealed interface Solution : Taggable<Solution> , Castable<Solution>

A type representing a solution to a goal, as produced by it.unibo.tuprolog.solve.Solver.solve.

Link copied to clipboard

A Formatter specialized in turning Solutions into human-readable Strings, e.g. for a REPL or logging.

Link copied to clipboard
interface SolveOptions

Configuration for a single Solver.solve invocation: whether solutions are computed lazily or eagerly, how long resolution may run for, how many solutions to cap at, and any implementation-specific extra knob.

Link copied to clipboard

General type for logic solvers, i.e. any entity capable of solving some logic query -- provided as a Struct -- according to some logic, implementing one or more inference rule, via some resolution strategy.

Link copied to clipboard
interface SolverBuilder

A mutable, fluent builder for Solver/MutableSolver instances, as an alternative to calling SolverFactory.solverOf (and friends) with many named arguments at once.

Link copied to clipboard
interface SolverFactory

A factory for a specific Solver implementation (i.e. a specific resolution strategy), providing both defaults for every piece of a solver's state and constructors for Solver/MutableSolver instances.

Link copied to clipboard
typealias TimeDuration = Long

This type represents how the solver will see time duration

Link copied to clipboard
typealias TimeInstant = Long

This type represents how the solver will see time instants

Functions

Link copied to clipboard
Link copied to clipboard

Platform-specific lookup of the :solve-concurrent SolverFactory (backing it.unibo.tuprolog.solve.Solver.concurrent).

Platform-specific lookup of the :solve-concurrent SolverFactory (backing it.unibo.tuprolog.solve.Solver.concurrent).

Platform-specific lookup of the :solve-concurrent SolverFactory (backing it.unibo.tuprolog.solve.Solver.concurrent).

Link copied to clipboard

A function returning current Time instant

A function returning current Time instant

A function returning current Time instant

Link copied to clipboard

Extracts this Struct indicator and converts it to Signature

Link copied to clipboard
inline fun <T> Iterable<T>.forEachWithLookahead(action: (T, Boolean) -> Unit)
inline fun <T> Iterator<T>.forEachWithLookahead(action: (T, Boolean) -> Unit)
inline fun <T> Sequence<T>.forEachWithLookahead(action: (T, Boolean) -> Unit)

Performs the given action on each element, giving a lookahead hint (i.e. if there's another element to process after).

Link copied to clipboard
fun getAllOperators(libraries: Runtime, vararg theories: Theory): Sequence<Operator>

Collects every Operator declared by libraries and by op/3 directives within theories.

Link copied to clipboard

Shorthand for this Library's declared Library.operators, as a Sequence.

Shorthand for this Runtime's declared Runtime.operators, as a Sequence.

Extracts every op/3 directive out of this collection of Clauses, converting each to an Operator.

Link copied to clipboard
fun libraryOf(alias: String? = null, item1: AbstractWrapper<*>, vararg items: AbstractWrapper<*>): Library

Assembles a Library out of one or more AbstractWrappers (i.e. it.unibo.tuprolog.solve.primitive.PrimitiveWrappers, it.unibo.tuprolog.solve.function.FunctionWrappers, or it.unibo.tuprolog.solve.rule.RuleWrappers), optionally named alias. Useful to declare a small, ad-hoc Library without hand-writing an implementation.

Link copied to clipboard

Platform-specific lookup of the :solve-problog SolverFactory (backing it.unibo.tuprolog.solve.Solver.problog).

Platform-specific lookup of the :solve-problog SolverFactory (backing it.unibo.tuprolog.solve.Solver.problog).

Platform-specific lookup of the :solve-problog SolverFactory (backing it.unibo.tuprolog.solve.Solver.problog).

Link copied to clipboard
fun runtimeOf(alias: String? = null, item1: AbstractWrapper<*>, vararg items: AbstractWrapper<*>): Runtime

Same as libraryOf, but wraps the resulting Library into a single-library Runtime.

Link copied to clipboard
fun Solver.solve(maxDuration: TimeDuration = TimeDuration.MAX_VALUE, scopedContext: Scope.() -> Struct): Sequence<Solution>

Solves the goal built by scopedContext within a fresh, empty Scope (useful to build the goal Struct using scoped variables inline), capping resolution to maxDuration.

Link copied to clipboard

Platform-specific lookup of the :solve-streams SolverFactory (backing it.unibo.tuprolog.solve.Solver.streams).

Platform-specific lookup of the :solve-streams SolverFactory (backing it.unibo.tuprolog.solve.Solver.streams).

Platform-specific lookup of the :solve-streams SolverFactory (backing it.unibo.tuprolog.solve.Solver.streams).

Link copied to clipboard