| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
|
|
|
|
The 'Rational Number Mode (Optional)' section was positioned right after
the title and before 'Installation', which was confusing for users.
This change moves the section to appear after 'Testing' and before
'License', following a more logical documentation flow:
1. What the tool is (title)
2. How to install it
3. How to use it (core features)
4. Optional advanced features (Rational mode)
5. Building and testing
6. License
|
|
- Updated Variable Management section with 'delete' command usage
- Added 'Working with Variables' section explaining:
- Variable persistence differences between REPL mode and bare mode
- Variable lifecycle and scope behavior
- Practical examples for both modes
|
|
- Added CI status badge (GitHub Actions)
- Added coverage badge (from coverage.json)
- Added Go Report Card badge
Coverage badge shows 80.6% coverage across all packages.
|
|
- Added documentation section to README.md explaining automatic coercion
- Included usage examples: '5 3 == 1 +', '0 false +', 'true 2 *', '9 3 > 4 5 < +'
- Updated Value type godoc to explain coercion behavior (true→1, false→0)
- toNumber() function already had good documentation
The coercion allows boolean results to be used directly in arithmetic operations,
enabling expressions like '5 3 == 1 +' where '5 3 ==' produces false=0, then '0 + 1' produces 1.
|
|
- Add RPN (Reverse Polish Notation) calculator with stack-based operations
- Support precise rational number calculations using *big.Rat
- Implement chain of responsibility pattern for command handling
- Add auto-completion for built-in commands
- Add history persistence with configurable max entries
- Support standard operators: +, -, *, /, ^, %, lg, log, ln
- Support hyper operators: [+], [-], [*], [/], [^], [%], [lg], [log], [ln]
- Support stack manipulation: dup, swap, pop, show
- Support variable assignments and management
- Add rat mode for switching between float64 and rational calculations
- Refactor calculator to return Calculation struct with formatting
- Add proper version support (v0.3.0)
All changes follow Go best practices with comprehensive test coverage.
|
|
- Renamed binary from perc to gt throughout the project
- Refactored calculator.Parse to use registration pattern for parsing strategies
- Refactored rpn.handleOperator to use operator registry instead of switch statements
- Added panic recovery to REPL executor for better resilience
- Improved code organization with OperatorRegistry and strategy registration
All changes maintain full test compatibility and pass race detection tests.
|
|
|
|
- Added HyperAdd, HyperMultiply, HyperSubtract, HyperDivide, HyperPower, HyperModulo
- Each hyper operator pops all values from stack and applies left-associative operation
- Updated token evaluation to recognize [op] pattern (e.g., [+], [-], [*], [/], [^], [%])
- Added comprehensive test cases for all hyper operators
- Updated README.md with hyper operator documentation and fixed persistent RPN state notes
Hyper operators allow operating on all stack values at once, while regular operators
work on the top two values.
|
|
|
|
- Bare expressions like '1 2 +' now work without 'calc' prefix
- Assignment format 'name value =' requires 'calc' subcommand prefix
|
|
|
|
Amp-Thread-ID: https://ampcode.com/threads/T-3883950c-6af3-4944-8596-7a40341c9c58
Co-authored-by: Amp <amp@ampcode.com>
|
|
|
|
Amp-Thread-ID: https://ampcode.com/threads/T-e4f4a959-8cc6-4ac0-b6fb-2779867e8b2a
Co-authored-by: Amp <amp@ampcode.com>
|