Termificator

interface Termificator

Converts arbitrary Kotlin values into Prolog Terms, so that DSL builders (see MinimalLogicProgrammingScope and friends) can accept a plain Any — a String, a Number, a Boolean, a List, ... — wherever a Term is expected, instead of forcing callers to spell out atomOf/intOf/logicListOf everywhere.

Conversion is driven by the runtime type of the value being converted:

All Terms produced by a given Termificator are created through its scope, so repeated conversions of the same variable name (e.g. "X" appearing twice while building a clause) resolve to the same it.unibo.tuprolog.core.Var.

Throws

if termify is given null, or a value whose runtime type — and none of its registered supertypes — has a registered conversion.

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val scope: Scope

The Scope backing every Term this Termificator produces.

Functions

Link copied to clipboard
abstract fun copy(scope: Scope = this.scope): Termificator

Creates a copy of this Termificator, backed by scope (defaulting to this one's own scope).

Link copied to clipboard
abstract fun termify(value: Any?): Term

Converts value into a Term, per this Termificator's conversion rules (see the type-level doc).