The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Math::Logic::Ternary::Calculator::Manual - user manual for tcalc

VERSION

This documentation refers to version 0.004 of tcalc.

SYNOPSIS

  tcalc
  tcalc 81
  tcalc 27 1

  perl -MMath::Logic::Ternary::Calculator -e 'tcalc(27, 1)'

  tcalc [word_size [arith_mode]]

DESCRIPTION

The ternary calculator tcalc is an interactive demonstration application for the perl library Math::Logic::Ternary.

It reads input line by line and tries to parse each line as either a command, an operator with operands, or operands alone.

Results are stored in a dynamically growing list of numbered values that can be used in subsequent operations.

Commands

?

Help. A question mark alone displays a list of available commands. A question mark followed by a command name or an operator name displays help about that particular command or operator.

?#

List numbered values of the current session.

?=

List named values of the current session.

/ops

/ops lists all operators.

/ops n lists all operators of kind n, where n is a small integer ranging from 0 to 3.

/license

/license displays a license and copyright notice.

/version

/version displays version information.

/size

/size displays the word size of this session.

/mode

/mode displays the current arithmetic mode.

/mode n changes the arithmetic mode to n, where valid modes are 0 = balanced, 1 = unbalanced, 2 = base(-3).

Note that while in the library arithmetic operators have suffixes denoting their type of arithmetic, operator names in the calculator have no suffix. The calculator will use the variant matching the current arithmetic mode.

Stored operands keep their trits, but generally not their numeric value when the arithmetic mode is changed, as the mode also determines the numeral system in use.

/def

/def name value stores a value under a name. This makes =name a valid operand.

/reset

/reset discards all stored values.

/reset 1 discards all numbered values.

/reset 2 discards all named values.

/range

/range returns two words: the smallest and largest possible integer (dependent on word size and arithmetic mode).

/rand

/rand returns a random word.

/abc

/abc n returns n words covering all trit combinations when used as operands of tritwise operators. The word size has to be at least 3 ** n. The trit order is affected by the arithmetic mode.

Example: /abc 2 returns @fffnnnttt and @fntfntfnt when in balanced mode.

/quit

/quit closes the session.

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.