Companion

object Companion

Properties

Link copied to clipboard

The pattern of an ill-formed functor for a Struct containing

Link copied to clipboard

The pattern of a well-formed functor for a Struct. A functor is well-formed if and only if:

Functions

Link copied to clipboard

Wraps the provided string within single quotes, unconditionally.

Link copied to clipboard

Wraps the provided string within single quotes, but only if it is not well-formed. Well-formed check is performed via the isWellFormedFunctor method.

Link copied to clipboard
fun escapeFunctor(string: String, escapeSingleQuotes: Boolean = true, escapeDoubleQuotes: Boolean = !escapeSingleQuotes): String

Unconditionally, escapes all occurrences of the characters \n, \r, \t, and \ in string. Depending on the value of parameters escapeDoubleQuotes and escapeSingleQuotes, occurrences of characters " and ' may be escaped as well.

Link copied to clipboard
fun escapeFunctorIfNecessary(string: String, escapeSingleQuotes: Boolean = true, escapeDoubleQuotes: Boolean = !escapeSingleQuotes): String

Escapes all occurrences of the characters \n, \r, \t, and \ in string, but only if a preliminary check reveals that it contains some character which require escaping. Depending on the value of parameters escapeDoubleQuotes and escapeSingleQuotes, occurrences of characters " and ' may be escaped as well.

Link copied to clipboard
fun fold(operator: String, terms: Iterable<Term>): Struct
fun fold(operator: String, terms: List<Term>): Struct
fun fold(operator: String, terms: Sequence<Term>): Struct
fun fold(operator: String, vararg terms: Term): Struct

Folds the Terms in terms from left to right, creating binary structures having operator as functor. Let f be the value of operator, and let t_i be the i-th term in terms. Then, this method constructs the Structure

fun fold(operator: String, terms: Iterable<Term>, terminal: Term?): Struct
fun fold(operator: String, terms: List<Term>, terminal: Term?): Struct
fun fold(operator: String, terms: Sequence<Term>, terminal: Term?): Struct
fun fold(operator: String, vararg terms: Term, terminal: Term?): Struct

Folds the Terms in terms from left to right, creating binary structures having operator as functor. Let f be the value of operator, and let t_i be the i-th term in terms. Then, if terminal is non-null, this method constructs the Structure

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun of(functor: String, args: Iterable<Term>): Struct

Creates a new Struct from the given Iterable of Terms. Instances of Struct are always created of the most adequate sub-type of Struct. This implies that, whenever possible, the creation of the new Struct may be delegated to:

fun of(functor: String, args: List<Term>): Struct

Creates a new Struct from the given KtList of Terms. Instances of Struct are always created of the most adequate sub-type of Struct. This implies that, whenever possible, the creation of the new Struct may be delegated to:

fun of(functor: String, args: Sequence<Term>): Struct

Creates a new Struct from the given Sequence of Terms. Instances of Struct are always created of the most adequate sub-type of Struct. This implies that, whenever possible, the creation of the new Struct may be delegated to:

fun of(functor: String, vararg args: Term): Struct

Creates a new Struct from the given Terms. Instances of Struct are always created of the most adequate sub-type of Struct. This implies that, whenever possible, the creation of the new Struct may be delegated to:

Link copied to clipboard
fun template(functor: String, arity: Int): Struct

Creates a new Struct with functor as functor and a given amount of anonymous Variables, namely arity. Instances of Struct are always created of the most adequate sub-type of Struct.