it.unibo.tuprolog.core

package it.unibo.tuprolog.core

Classes

Name Description
interface Atom: Struct, Constant, Any

Base type for constant, alphanumeric Terms, a.k.a. strings. An Atom is at the same time a String-valued Constant and a 0-argument Struct, whose functor is equal to value.

interface Block: Recursive, Any
class BlockIterator: Iterator<Term>, Any
interface Clause: Struct, Any
interface Cons: List, Any
interface Constant: Term, Any
interface Directive: Clause, Any
interface Empty: Atom, Any
interface EmptyBlock: Empty, Block, Any
interface EmptyList: Empty, List, Any
interface Fact: Rule, Any
interface Formatter<T> : Any

A type for objects encapsulating some logic to convert any object of type T into a String

interface Indicator: Struct, Any

A predicate indicator is used to denote predicates or functors.

It is a ground term of the form Name/Arity where Name is an Atom denoting the name of a predicate or a functor and Arity is a non-negative Integer denoting the number of its arguments.

Examples: sumlist/2, '.'/2, '/'/2, animal/1, '1'/0.

interface Integer: Numeric, Any
interface List: Recursive, Any
sealed class ListIterator: Iterator<Term>, Any
interface Numeric: Constant, Any
interface Real: Numeric, Any
interface Recursive: Struct, Any
interface Rule: Clause, Any
interface Scope: Any
interface Struct: Term, Any

Base type for compound Terms, a.k.a. structures. A Struct is characterised by a functor and a given (non-negative) amount of args, namely arity. Each argument can be a Term of any sort.

sealed interface Substitution: Map<Var, Term>, Any

General type for logic substitutions (i.e. variables assignments). There are two sorts of substitutions:

interface Term: Comparable<Term>, Any

Base type for all logic terms. Terms are immutable tree-like data structures.

interface TermComparator<T : Term> : Any
interface TermConvertible: Any

An interface to be implemented by types convertible to Prolog Terms

interface TermFormatter: Formatter<Term>, TermVisitor<String>, Any

A particular sort of Formatters aimed at representing terms

interface TermVisitor<T> : Any
object Terms: Any
interface Truth: Atom, Any
interface Tuple: Recursive, Any
class TupleIterator: Iterator<Term>, Any
interface Var: Term, Any

Methods

prepareForExecution

fun Clause.prepareForExecution(): Clause

Prepares the receiver Clause for execution, using the provided visitor

For example, the Clause product(A) :- A, A is transformed, after preparation for execution, as the Term: product(A) :- call(A), call(A)

Receiver

Name Description
Clause

ReturnValue

Name Description
Clause

prepareForExecution

fun Clause.prepareForExecution(unifier: Unifier): Clause

Receiver

Name Description
Clause

Parameters

Name Description
unifier: Unifier

ReturnValue

Name Description
Clause

compareStringsLocaleIndependently

expect fun compareStringsLocaleIndependently(string1: String, string2: String): Int

Parameters

Name Description
string1: String
string2: String

ReturnValue

Name Description
Int

toTerm

fun BigInteger.toTerm(): Integer

Receiver

Name Description
BigInteger

ReturnValue

Name Description
Integer

toTerm

fun Sequence<Term>.toTerm(): List

Receiver

Name Description
Sequence<Term>

ReturnValue

Name Description
List

format

fun <T> T.format(formatter: Formatter<T>): String

Receiver

Name Description
T

Parameters

Name Description
formatter: Formatter<T>

ReturnValue

Name Description
String

toTerm

fun Float.toTerm(): Real

Receiver

Name Description
Float

ReturnValue

Name Description
Real

toTerm

fun Double.toTerm(): Real

Receiver

Name Description
Double

ReturnValue

Name Description
Real

toTerm

fun Int.toTerm(): Integer

Receiver

Name Description
Int

ReturnValue

Name Description
Integer

toTerm

fun Long.toTerm(): Integer

Receiver

Name Description
Long

ReturnValue

Name Description
Integer

toTerm

fun Short.toTerm(): Integer

Receiver

Name Description
Short

ReturnValue

Name Description
Integer

toTerm

fun Byte.toTerm(): Integer

Receiver

Name Description
Byte

ReturnValue

Name Description
Integer

toTerm

fun Number.toTerm(): Numeric

Receiver

Name Description
Number

ReturnValue

Name Description
Numeric

toTerm

fun String.toTerm(): Term

Receiver

Name Description
String

ReturnValue

Name Description
Term

toAtom

fun String.toAtom(): Atom

Receiver

Name Description
String

ReturnValue

Name Description
Atom

toVar

fun String.toVar(): Var

Receiver

Name Description
String

ReturnValue

Name Description
Var

toTerm

fun List<Term>.toTerm(): List

Receiver

Name Description
List<Term>

ReturnValue

Name Description
List

toTerm

fun Iterable<Term>.toTerm(): List

Receiver

Name Description
Iterable<Term>

ReturnValue

Name Description
List

toTerm

fun Array<Term>.toTerm(): List

Receiver

Name Description
Array<Term>

ReturnValue

Name Description
List

asUnifier

fun Map<Var, Term>.asUnifier(): Unifier

Conversion from a raw Map to the Substitution.Unifier type

Receiver

Name Description
Map<Var, Term>

ReturnValue

Name Description
Unifier