NAME

Logic::Relational::Term - Represents a compound term in the logic engine.

SYNOPSIS

use Logic::Relational::Term;
my $term = Logic::Relational::Term->new(
    functor => 'owns',
    args    => [$perp, $stuff]
);

DESCRIPTION

Logic::Relational::Term represents a compound term containing a functor name and an array of arguments. Arguments can be other terms, variables, or constants.

METHODS

new

Constructor. Takes functor and args (arrayref).

functor

Returns the functor string.

args

Returns the arrayref of arguments.

arity

Returns the number of arguments.

arg

Returns the argument at the specified 0-based index.

as_string

Returns a formatted string representation of the compound term, e.g. owns(X, gold).

freshen

Recursively freshens all variables in its arguments using the provided variable mapping, returning a new Logic::Relational::Term object.