The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Math::Logic::Ternary::Calculator - interactive ternary calculator

VERSION

This documentation refers to version 0.004 of Math::Logic::Ternary::Calculator.

SYNOPSIS

  use Math::Logic::Ternary::Calculator;

  tcalc(81);            # run a calculator with word size 81
  tcalc;                # run a calculator with default word size

DESCRIPTION

tcalc

tcalc($word_size, $mode) takes a word size, creates a calculator state object with words of the given size and a session object acting on the state object, and it runs the session interactively. The numerical mode parameter is optional. It specifies an initial arithmetic mode. Default mode is 0, meaning balanced arithmetic.

Exports

The subroutine tcalc is automatically exported into the namespace of the caller. There are no other exports.

COMPONENTS

The calculator is implemented using these modules:

Math::Logic::Ternary::Calculator::Version

Text constants identifying the application and its version.

Math::Logic::Ternary::Calculator::Mode

Class for arithmetic operation mode.

Math::Logic::Ternary::Calculator::Operator

Class for operators performing ternary computations.

Math::Logic::Ternary::Calculator::Command

Class for general user commands.

Math::Logic::Ternary::Calculator::Parser

Class for interactive input parsing.

Math::Logic::Ternary::Calculator::State

Class for ternary data storage.

Math::Logic::Ternary::Calculator::Session

Class driving ternary calculator sessions.

Math::Logic::Ternary::Calculator

Top-Level interface providing the tcalc() function.

Their dependency hierarchy is as follows:

  +-----------------------------------------------------+
  |                     Calculator                      |
  +--------+-----------------+--------------------------+
           |                 |
           |  +--------------V--------------+
           |  |           Session           |
           |  +--+-----+-----+-----+-----+--+
           |     |     |     |     |     |
  +--------V-----V--+  |     |     |  +--V--------------+
  |      State      |  |     |     |  |     Parser      |
  +--------+-----+--+  |     |     |  +--------+-----+--+
           |     |     |     |     |           |     |
           |     |     |     |  +--V-----------V--+  |
           |     |     |     |  |     Command     |  |
           |     |     |     |  +--+-----------+--+  |
           |     |     |     |     |           |     |
           |     |     |  +--V-----V--------+  |     |
           |     |     |  |    Operator     |  |     |
           |     |     |  +--+-----+--------+  |     |
           |     |     |     |     |           |     |
           |  +--V-----V-----V--+  |  +--------V-----V--+
           |  |      Mode       |  |  |     Version     |
           |  +-----------------+  |  +-----------------+
           |                       |
  +--------V-----------------------V--------------------+
  |                Math::Logic::Ternary                 |
  +-----------------------------------------------------+

SEE ALSO

AUTHOR

Martin Becker <becker-cpan-mp@cozap.com>

COPYRIGHT AND LICENSE

Copyright (c) 2012-2017 by Martin Becker, Blaubeuren. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.