Package-level declarations

Types

Link copied to clipboard

Base class for implementing ISO arithmetic comparison predicates (=:=/2, =\=/2, </2, >/2, =</2, >=/2), i.e. BinaryRelation.Predicatives that first evaluate both arguments as arithmetic expressions (via it.unibo.tuprolog.solve.function.evalAsArithmeticExpression, raising an it.unibo.tuprolog.solve.exception.error.InstantiationError if unbound, or a it.unibo.tuprolog.solve.exception.error.TypeError if not evaluable/numeric) before comparing the resulting Numeric values via computeNumeric.

Link copied to clipboard
abstract class BinaryRelation<E : ExecutionContext>(operator: String) : PrimitiveWrapper<E>

Base class to implement primitives that relate two Terms and provide a single response, sparing implementers from manually pulling first/second out of Solve.Request.arguments and checking the request's arity (always 2, enforced by PrimitiveWrapper).

Link copied to clipboard

A base class to implement predicates with zero arguments (e.g. !/0, nl/0, repeat/0). Follows the same design (and same ladder of nested subclasses -- WithoutSideEffects, NonBacktrackable, Functional, Predicative) as BinaryRelation; see its KDoc for the full rationale. Also available as ZeroaryPredicate.

Link copied to clipboard
fun interface Primitive

A typealias for a primitive function that accepts a Solve.Request and returns a Sequence of Solve.Responses

Link copied to clipboard

Wrapper class for Primitive implementation

Link copied to clipboard

Base class to implement primitives that relate four Terms, sparing implementers from manually pulling first/second/third/fourth out of Solve.Request.arguments. Follows the same design (and same ladder of nested subclasses -- WithoutSideEffects, NonBacktrackable, Functional, Predicative) as BinaryRelation; see its KDoc for the full rationale.

Link copied to clipboard
abstract class QuinaryRelation<E : ExecutionContext>(operator: String) : PrimitiveWrapper<E>

Base class to implement primitives that relate five Terms, sparing implementers from manually pulling first/second/third/fourth/fifth out of Solve.Request.arguments. Follows the same design (and same ladder of nested subclasses -- WithoutSideEffects, NonBacktrackable, Functional, Predicative) as BinaryRelation; see its KDoc for the full rationale.

Link copied to clipboard
sealed class Solve

A base class for Solve requests and responses

Link copied to clipboard
abstract class TernaryRelation<E : ExecutionContext>(operator: String) : PrimitiveWrapper<E>

Base class to implement primitives that relate three Terms, sparing implementers from manually pulling first/second/third out of Solve.Request.arguments. Follows the same design (and same ladder of nested subclasses -- WithoutSideEffects, NonBacktrackable, Functional, Predicative) as BinaryRelation; see its KDoc for the full rationale.

Link copied to clipboard

Base class for unary predicates (arity 1) that always succeed if their argument is of the expected type, and throw otherwise, rather than merely testing and failing on mismatch (contrast with TypeTester). ensureType is expected to throw (typically a it.unibo.tuprolog.solve.exception.error.TypeError) on a mismatching term, and return normally otherwise.

Link copied to clipboard

Base class for ISO type-checking predicates of arity 1 (e.g. atom/1, var/1, is_list/1): succeeds if testType returns true for the (dereferenced) argument, fails (rather than throwing) otherwise. Contrast with TypeEnsurer, which throws instead of failing.

Link copied to clipboard
abstract class UnaryPredicate<E : ExecutionContext>(operator: String) : PrimitiveWrapper<E>

A base class to implement predicates with one argument, sparing implementers from manually pulling first out of Solve.Request.arguments. Follows the same design (and same ladder of nested subclasses -- WithoutSideEffects, NonBacktrackable, Functional, Predicative) as BinaryRelation; see its KDoc for the full rationale. TypeTester and TypeEnsurer further specialize Predicative for X type-checking predicates (e.g. atom/1, var/1) and type-enforcing ones respectively.

Link copied to clipboard

Alias for PredicateWithoutArguments, named after the "zeroary" (arity-0) predicates it helps implement.