Compound class

A Prolog compound term (structure).

Compound terms have a functor (atom) and zero or more arguments. They represent structures like: f(a,b), person(john, 25), +(1,2)

Special cases:

  • Arity 0: Equivalent to an atom (but represented as Atom, not Compound)
  • Lists: Use functor '.' with arity 2 (head and tail)

Examples: foo(bar), f(X, Y), H|T (represented as '.'(H, T))

Inheritance

Constructors

Compound(Atom functor, List<Term> args)
Creates a compound term with the given functor and arguments.

Properties

args List<Term>
The arguments of this compound term.
final
arity int
The arity (number of arguments) of this compound term.
no setter
functor Atom
The functor (name) of this compound term.
final
hashCode int
The hash code for this object.
no setteroverride
indicator String
Returns the functor/arity indicator (e.g., "foo/2").
no setter
isAtom bool
Returns true if this term is an atom.
no setterinherited
isAtomic bool
Returns true if this term is atomic (atom or number).
no setterinherited
isCallable bool
Returns true if this term is callable (atom or compound).
no setterinherited
isCompound bool
Returns true if this term is a compound term.
no setteroverride
isFloat bool
Returns true if this term is a float.
no setterinherited
isGround bool
Returns true if this term is ground (contains no unbound variables).
no setteroverride
isInteger bool
Returns true if this term is an integer.
no setterinherited
isList bool
Returns true if this term is a list (including empty list).
no setteroverride
isNil bool
Returns true if this term is the empty list [].
no setterinherited
isNumber bool
Returns true if this term is a number (integer or float).
no setterinherited
isVariable bool
Returns true if this term is a variable.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

fromList(List<Term> elements, [Term? tail]) Term
Converts a Dart list of terms to a Prolog list.
toList(Term term) List<Term>?
Converts a Prolog list to a Dart list of terms. Returns null if the term is not a proper list.