blob: 565f396d1820c2cdbd867fbea2c05654648b4bdb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# gt
A command-line calculator with percentage calculations and RPN (Reverse Polish Notation) stack arithmetic, written in Go.

This is a toy project to experiment with local LLMs (Qwen, Gemma, Nemotron, GPT OSS) as pair programmers.
## Installation
```bash
go install codeberg.org/snonux/gt/cmd/gt@latest
```
Or using [mage](https://github.com/magefile/mage):
```bash
mage install
```
## Quick Start
```bash
gt '20% of 150' # → 30
gt '3 4 +' # RPN: 3 + 4 → 7
gt 'pi 2 *' # 2π → 6.283185307
gt '100Mbps 1hr *' # rate × time → 3.6e+11 bits
gt # interactive REPL
```
## Feature Guide
All features are documented in [`docs/`](docs/):
| Topic | Doc |
|-------|-----|
| CLI modes, piping, REPL | [cli-usage](docs/cli-usage.md) |
| Percentage calculations | [percentage-calculations](docs/percentage-calculations.md) |
| RPN basics | [basic-arithmetic](docs/basic-arithmetic.md) |
| Fast integer power (`**`) | [fast-power](docs/fast-power.md) |
| Logarithm operators | [log-operators](docs/log-operators.md) |
| Hyper (n-ary) operators | [hyper-operators](docs/hyper-operators.md) |
| Comparisons and booleans | [comparisons](docs/comparisons.md) |
| Variables and assignment | [variables](docs/variables.md) |
| Symbols (`:x` syntax) | [symbols](docs/symbols.md) |
| Built-in constants | [constants](docs/constants.md) |
| Stack manipulation | [stack-operations](docs/stack-operations.md) |
| Metrics and units | [metrics](docs/metrics.md) |
| Unit conversion | [unit-conversion](docs/unit-conversion.md) |
| Metric commands | [metric-commands](docs/metric-commands.md) |
| Custom metrics | [custom-metrics](docs/custom-metrics.md) |
| REPL mode | [repl-mode](docs/repl-mode.md) |
| Rational number mode | [rational-mode](docs/rational-mode.md) |
## Building and Testing
```bash
mage build # Build the binary
mage test # Run all tests
```
## License
See [LICENSE](LICENSE) for details.
|