Term
public struct Term<Atom: Hashable>
The data type used to represent atoms and compound terms. Takes the form bar
or foo(bazz, buzz)
for any arity.
Note that an atom is just a special case of a compound term with 0 arguments.
-
The name of the term.
Declaration
Swift
public var name: Atom
-
The arguments to the term, which are also terms themselves (except wrapped in a
Unifiable
to support recursive unification).Declaration
Swift
public var arguments: [Unifiable<Term<Atom>>]
-
Construct an atom.
Declaration
Swift
public init(atom: Atom)
-
The number of arguments of the term.
Declaration
Swift
public var arity: Int
-
A textual represntation of
self
.Declaration
Swift
public var description: String
-
Unifies
lhs
withrhs
, recursively unifying their subtrees, else throws aUnificationError
.Declaration
Swift
public static func unify(lhs: Term, _ rhs: Term) throws
-
Performs
action
as an operation onself
such that the the unification status of the term will be unmodified if teh unification fails.Declaration
Swift
public static func attempt(value: Term, _ action: () throws -> ()) throws
-
Copies
this
reusing any substructure that has already been copied within this context, and storing any newly generated substructure into the context.Declaration
Swift
public static func copy(this: Term, withContext context: CopyContext) -> Term
-
The name-arity signature of
self
.Declaration
Swift
public var functor: Functor<Atom>