interface List: Recursive, Any
Fields
Name | Description |
---|---|
open isList: Boolean
|
Checks whether the current term is a (logic) list, i.e., either an empty list or a Cons.
This method is guaranteed to return |
abstract isWellFormed: Boolean
|
|
abstract last: Term
|
|
abstract estimatedLength: Int
|
Estimated length of this list. This property is part of the List interface to enable efficiency tweaks. It is NOT intended for external usage DO NOT assume this returns the correct length of the current list. |
abstract unfoldedSequence: Sequence
|
|
abstract unfoldedList: List<Term>
|
|
abstract unfoldedArray: Array<Term>
|
|
open size: Int
|
Methods
freshCopy
abstract fun freshCopy(): List
ReturnValue
Name | Description |
---|---|
List
|
a fresh copy of the current term which is different because variables are consistently renamed |
freshCopy
abstract fun freshCopy(scope: Scope): List
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 |
---|---|
List
|
a fresh copy of the current term which is different because variables are consistently renamed |
Extensions
toClause
fun Term.toClause(source: Any?, line: Int, column: Int): Clause
Receiver
Name | Description |
---|---|
Term
|
Parameters
Name | Description |
---|---|
source: Any?
|
|
line: Int
|
|
column: Int
|
ReturnValue
Name | Description |
---|---|
Clause
|
unfoldGoals
fun Term.unfoldGoals(): Sequence
Receiver
Name | Description |
---|---|
Term
|
ReturnValue
Name | Description |
---|---|
Sequence
|
toGoals
fun Term.toGoals(): Cursor
Receiver
Name | Description |
---|---|
Term
|
ReturnValue
Name | Description |
---|---|
Cursor
|
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
|
extractSignature
fun Struct.extractSignature(): Signature
Receiver
Name | Description |
---|---|
Struct
|
ReturnValue
Name | Description |
---|---|
Signature
|
evalAsExpression
fun Term.evalAsExpression(request: Request<*>, index: Int?): Term
Receiver
Name | Description |
---|---|
Term
|
Parameters
Name | Description |
---|---|
request: Request<*>
|
|
index: Int?
|
ReturnValue
Name | Description |
---|---|
Term
|
CompanionObject
List
interface List: Recursive, Any
Fields
Name | Description |
---|---|
const CONS_FUNCTOR: String
|
|
const EMPTY_LIST_FUNCTOR: String
|
Methods
of
fun of(vararg items: Term): List
Parameters
Name | Description |
---|---|
vararg items: Term
|
ReturnValue
Name | Description |
---|---|
List
|
of
fun of(items: Iterable<Term>): List
Parameters
Name | Description |
---|---|
items: Iterable<Term>
|
ReturnValue
Name | Description |
---|---|
List
|
of
fun of(items: List<Term>): List
Parameters
Name | Description |
---|---|
items: List<Term>
|
ReturnValue
Name | Description |
---|---|
List
|
of
fun of(items: Sequence
Parameters
Name | Description |
---|---|
items: Sequence
|
ReturnValue
Name | Description |
---|---|
List
|
from
fun from(vararg items: Term): List
Parameters
Name | Description |
---|---|
vararg items: Term
|
ReturnValue
Name | Description |
---|---|
List
|
from
fun from(items: Iterable<Term>): List
Parameters
Name | Description |
---|---|
items: Iterable<Term>
|
ReturnValue
Name | Description |
---|---|
List
|
from
fun from(items: Sequence
Parameters
Name | Description |
---|---|
items: Sequence
|
ReturnValue
Name | Description |
---|---|
List
|
from
fun from(items: List<Term>): List
Parameters
Name | Description |
---|---|
items: List<Term>
|
ReturnValue
Name | Description |
---|---|
List
|
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.