| 1 | package Logic::Relational::Atom; | ||
| 2 | |||
| 3 | 32 | ▶ | use v5.38; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 32 | ▶ | use experimental 'signatures'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | Logic::Relational::Atom - Represents a symbolic constant (atom) in the logic engine. | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | use Logic::Relational::Atom; | ||
| 13 | my $atom = Logic::Relational::Atom->new('gold'); | ||
| 14 | say $atom->value; # gold | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | C<Logic::Relational::Atom> represents a symbolic constant/atom in the relational | ||
| 19 | logic engine. These are immutable constants and are used in structural unification. | ||
| 20 | |||
| 21 | =head1 METHODS | ||
| 22 | |||
| 23 | =head2 new | ||
| 24 | |||
| 25 | Constructor. Takes a single scalar value. | ||
| 26 | |||
| 27 | =head2 value | ||
| 28 | |||
| 29 | Returns the raw scalar value. | ||
| 30 | |||
| 31 | =head2 as_string | ||
| 32 | |||
| 33 | Returns the string representation of the atom. | ||
| 34 | |||
| 35 | =head2 freshen | ||
| 36 | |||
| 37 | Returns the atom itself (since constants do not contain variables). | ||
| 38 | |||
| 39 | =cut | ||
| 40 | |||
| 41 | 4 | ▶ | sub new ( $class, $value ) { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 42 | 4 | return bless { value => $value }, $class; | |
| 43 | } | ||
| 44 | |||
| 45 | 6 | ▶ | sub value ($self) { |
|
Subroutine
value: called CC=1 SCAR=0.0
Pod
documented
| |||
| 46 | 6 | return $self->{value}; | |
| 47 | } | ||
| 48 | |||
| 49 | 1 | ▶ | sub as_string ($self) { |
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||
| 50 | 1 | return $self->{value}; | |
| 51 | } | ||
| 52 | |||
| 53 | 1 | ▶ | sub freshen ( $self, $var_map ) { |
|
Subroutine
freshen: called CC=1 SCAR=0.0
Pod
documented
| |||
| 54 | 1 | return $self; | |
| 55 | } | ||
| 56 | |||
| 57 | 32 | 1; | |