Indicator

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.

Fields

Name Description
open isIndicator: Boolean

Checks whether the current term is an indicator. This method is guaranteed to return true if and only if the current term is an instance of Indicator.

open functor: String
open args: Array<Term>
open arity: Int
abstract nameTerm: Term

The indicated functor name Term

abstract arityTerm: Term

The indicated functor arity Term

open isWellFormed: Boolean

Whether this Indicator is well-formed

An indicator is well-formed when:

  • its nameTerm is an Atom
  • its arityTerm is a non-negative Integer
open indicatedName: String?

The indicated functor name, if well-formed

open indicatedArity: Int?

The indicated functor arity, if well-formed

Methods

freshCopy

open fun freshCopy(): Indicator

Returns a fresh copy of this Term, that is, an instance of Term which is equal to the current one in any aspect, except variables directly or indirectly contained into this Term, which are refreshed. This means that it could return itself, if no variable is present (ground term), or a new Term with freshly generated variables.

Variables are refreshed consistently, meaning that, if more variables exists within this Term having the same name, all fresh copies of such variables will have the same complete name.

Example: "f(X, g(X))".freshCopy() returns something like "f(X_1, g(X_1))" instead of "f(X_1, g(X_2))"

Notice that, if the current term is ground, the same object may be returned as a result by this method.

ReturnValue

Name Description
Indicator

a fresh copy of the current term which is different because variables are consistently renamed

freshCopy

open fun freshCopy(scope: Scope): Indicator

Returns a fresh copy of this Term, similarly to freshCopy, possibly reusing variables from the provided scope, if any

Parameters

Name Description
scope: Scope

the Scope containing variables to be used in copying

ReturnValue

Name Description
Indicator

a fresh copy of the current term which is different because variables are consistently renamed

Extensions

extractSignature

fun Struct.extractSignature(): Signature

Extracts this Struct indicator and converts it to Signature

Receiver

Name Description
Struct

ReturnValue

Name Description
Signature

unfoldGoals

fun Term.unfoldGoals(): Sequence<Term>

Receiver

Name Description
Term

ReturnValue

Name Description
Sequence<Term>

toGoals

fun Term.toGoals(): Cursor<Term>

Receiver

Name Description
Term

ReturnValue

Name Description
Cursor<Term>

isWellFormed

fun Term.isWellFormed(): Boolean

Check whether the receiver term is a well-formed predication

Receiver

Name Description
Term

ReturnValue

Name Description
Boolean

prepareForExecutionAsGoal

fun Term.prepareForExecutionAsGoal(): Struct

Prepares the receiver Goal for execution

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

Receiver

Name Description
Term

ReturnValue

Name Description
Struct

eq

infix fun Term.eq(that: Term): Equation<Term, Term>

Creates an equation with this and that terms

Receiver

Name Description
Term

Parameters

Name Description
that: Term

ReturnValue

Name Description
Equation<Term, Term>

CompanionObject

Indicator

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.

Fields

Name Description
const FUNCTOR: String

The canonical indicator functor: /

Methods

of

fun of(name: Term, arity: Term): Indicator

Creates an indicator denoting functor named name with arity

Parameters

Name Description
name: Term
arity: Term

ReturnValue

Name Description
Indicator

of

fun of(name: String, arity: Int): Indicator

Creates an indicator denoting functor named name with arity

Parameters

Name Description
name: String
arity: Int

ReturnValue

Name Description
Indicator