From c4a21a5ce5bec05798f725151c6bf09cb6507027 Mon Sep 17 00:00:00 2001
From: Paul Buetow
Logarithms
Three unary operators for when you need them:
@@ -152,7 +166,16 @@ gt '2 5 10 [*]' '1000 2 2 2 2 [/]' # → 62.5
-Full set: [+], [-], [*], [/], [^], [%] for arithmetic, plus [lg], [log], [ln] for logarithms. The log hyper operators work differently from the arithmetic ones — they compute the sum of the log function applied to each value, not a left-associative reduction. The square-bracket syntax is inspired by Raku's hyper operators.
+Full set: [+], [-], [*], [/], [^], [%] for arithmetic, plus [lg], [log], [ln] for logarithms. The log hyper operators work differently from the arithmetic ones — they compute the sum of the log function applied to each value, not a left-associative reduction. A quick entropy calculation:
+
+
+gt '0.25 0.5 0.25 [lg]' # → -5 (information theory entropy bits)
+
+
+The square-bracket syntax is inspired by Raku's hyper operators.
https://raku.org
@@ -189,6 +212,16 @@ http://www.gnu.org/software/src-highlite -->
gt '105 68 gte 100 lte +' # → 1 (out of range)
+Booleans also do plain arithmetic, which is occasionally useful:
+
+
+gt 'true true +' # → 2 (1 + 1)
+gt 'false 5 +' # → 5 (0 + 5)
+
+
Variables and symbols
Store values with three assignment styles:
@@ -204,7 +237,19 @@ gt 'rate 100Mbps =' 10 := # define x
+> x # pushes 10 (variable resolved)
+> :x # pushes :x (the symbol itself)
+> :x d # deletes the variable x
+
+
+Bare identifiers that don't match any variable or constant also push as symbols.
Built-in constants
@@ -222,6 +267,8 @@ gt 'sqrt2 sqrt3 *' '1GB 1024MB eq' 304.8 Distance # surveyor's reel
-custom define fortnight 1209600 Time
+custom define reel 304.8 Distance # surveyor's reel
+custom define fortnight 1209600 Time # 14 days
+custom define cup 240 Weight # cooking measure
-Then use them like built-ins: 5reel @m convert → 1524.
+Then use them like built-ins:
+
+
+> 5reel @m convert
+1524
+> 2fortnight @day convert
+28
+> 3cup @g convert
+720
+
SI vs IEC modes
Data size units have two modes. SI (default) uses powers of 1000. IEC uses powers of 1024. Switch with metric decimal set / metric binary set. The dedicated IEC units (KiB, MiB, GiB) are always unambiguous.
+Discovering metrics
+
+You can explore what's available without leaving the REPL:
+
+
+> metric list
+DataRate, DataSize, Distance, Speed, Time, Universal, Weight
+> metric DataRate
+Gbps, Kbps, Mbps, Tbps, bps
+
+
+metric compatible checks whether two values can be combined before you try:
+
+
+> 1km 5mi metric compatible
+km (Distance) and mi (Distance): true
+> 100Mbps 2hr metric compatible
+Mbps (DataRate) and hr (Time): false
+
+
Stack manipulation
Five operators for managing the RPN stack:
@@ -324,7 +410,7 @@ custom define fortnight 1209600 Time
- show / showstack / print — display the stack without modifying it
- clear — clear all variables and constants
-dup and swap come up a lot. Square a number: 7 dup * → 49. Reverse operand order: 2 10 swap / → 5 (instead of 0.2).
+dup and swap come up a lot. Square a number: 7 dup * → 49. Reverse operand order: 2 10 swap / → 5 (instead of 0.2). pop discards the top value if you pushed something by accident: 5 6 pop → 5.
Rational number mode
@@ -364,9 +450,19 @@ Rational mode enabled
Run gt with no arguments when attached to a terminal and you get the interactive session. Command history (1000 entries, persisted to ~/.gt_history), tab completion, Emacs-style line editing, Ctrl+R reverse search.
-Variables save to disk between sessions. Session logging with --log session.log. Session state lives in ~/.local/state/gt/vars.
+Variables save to disk between sessions. Session state lives in ~/.local/state/gt/vars. For auditing or note-taking, session logging works like this:
-Built-in REPL commands: help, clear, quit/exit, rpn/calc, rat, stack. Tab-completes.
+
+$ gt --log calc-session.log
+> 1Gbps 1hr *
+> @GB convert
+> quit
+
+
+Built-in REPL commands: help, clear, quit/exit, rpn/calc, rat, stack. stack is a shorthand hint for viewing the RPN stack. Tab-completes.
Here's what a session looks like:
@@ -494,6 +590,8 @@ http://www.gnu.org/software/src-highlite -->
Or from the source directory: mage install.
+One quirk: there are no -h or --help flags. gt version gives you the version, and bare gt with no TTY prints usage. If you pass -h, gt tries to evaluate it as RPN and errors. It's intentional and keeps the surface area small.
+
Wrapping up
The local LLM experiment worked. The code is clean enough, the tests pass, the docs are thorough, and I use the tool. The logo was generated by a local model too.
diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml
index cb95cf18..d3259c9c 100644
--- a/gemfeed/atom.xml
+++ b/gemfeed/atom.xml
@@ -1,6 +1,6 @@
Logarithms
Three unary operators for when you need them:
@@ -159,7 +173,16 @@ gt '2 5 10 [*]' '1000 2 2 2 2 [/]' # → 62.5
-Full set: [+], [-], [*], [/], [^], [%] for arithmetic, plus [lg], [log], [ln] for logarithms. The log hyper operators work differently from the arithmetic ones — they compute the sum of the log function applied to each value, not a left-associative reduction. The square-bracket syntax is inspired by Raku's hyper operators.
+Full set: [+], [-], [*], [/], [^], [%] for arithmetic, plus [lg], [log], [ln] for logarithms. The log hyper operators work differently from the arithmetic ones — they compute the sum of the log function applied to each value, not a left-associative reduction. A quick entropy calculation:
+
+
+gt '0.25 0.5 0.25 [lg]' # → -5 (information theory entropy bits)
+
+
+The square-bracket syntax is inspired by Raku's hyper operators.
https://raku.org
@@ -196,6 +219,16 @@ http://www.gnu.org/software/src-highlite -->
gt '105 68 gte 100 lte +' # → 1 (out of range)
+Booleans also do plain arithmetic, which is occasionally useful:
+
+
+gt 'true true +' # → 2 (1 + 1)
+gt 'false 5 +' # → 5 (0 + 5)
+
+
Variables and symbols
Store values with three assignment styles:
@@ -211,7 +244,19 @@ gt 'rate 100Mbps =' 10 := # define x
+> x # pushes 10 (variable resolved)
+> :x # pushes :x (the symbol itself)
+> :x d # deletes the variable x
+
+
+Bare identifiers that don't match any variable or constant also push as symbols.
Built-in constants
@@ -229,6 +274,8 @@ gt 'sqrt2 sqrt3 *' '1GB 1024MB eq' 304.8 Distance # surveyor's reel
-custom define fortnight 1209600 Time
+custom define reel 304.8 Distance # surveyor's reel
+custom define fortnight 1209600 Time # 14 days
+custom define cup 240 Weight # cooking measure
-Then use them like built-ins: 5reel @m convert → 1524.
+Then use them like built-ins:
+
+
+> 5reel @m convert
+1524
+> 2fortnight @day convert
+28
+> 3cup @g convert
+720
+
SI vs IEC modes
Data size units have two modes. SI (default) uses powers of 1000. IEC uses powers of 1024. Switch with metric decimal set / metric binary set. The dedicated IEC units (KiB, MiB, GiB) are always unambiguous.
+Discovering metrics
+
+You can explore what's available without leaving the REPL:
+
+
+> metric list
+DataRate, DataSize, Distance, Speed, Time, Universal, Weight
+> metric DataRate
+Gbps, Kbps, Mbps, Tbps, bps
+
+
+metric compatible checks whether two values can be combined before you try:
+
+
+> 1km 5mi metric compatible
+km (Distance) and mi (Distance): true
+> 100Mbps 2hr metric compatible
+Mbps (DataRate) and hr (Time): false
+
+
Stack manipulation
Five operators for managing the RPN stack:
@@ -331,7 +417,7 @@ custom define fortnight 1209600 Time
- show / showstack / print — display the stack without modifying it
- clear — clear all variables and constants
-dup and swap come up a lot. Square a number: 7 dup * → 49. Reverse operand order: 2 10 swap / → 5 (instead of 0.2).
+dup and swap come up a lot. Square a number: 7 dup * → 49. Reverse operand order: 2 10 swap / → 5 (instead of 0.2). pop discards the top value if you pushed something by accident: 5 6 pop → 5.
Rational number mode
@@ -371,9 +457,19 @@ Rational mode enabled
Run gt with no arguments when attached to a terminal and you get the interactive session. Command history (1000 entries, persisted to ~/.gt_history), tab completion, Emacs-style line editing, Ctrl+R reverse search.
-Variables save to disk between sessions. Session logging with --log session.log. Session state lives in ~/.local/state/gt/vars.
+Variables save to disk between sessions. Session state lives in ~/.local/state/gt/vars. For auditing or note-taking, session logging works like this:
-Built-in REPL commands: help, clear, quit/exit, rpn/calc, rat, stack. Tab-completes.
+
+$ gt --log calc-session.log
+> 1Gbps 1hr *
+> @GB convert
+> quit
+
+
+Built-in REPL commands: help, clear, quit/exit, rpn/calc, rat, stack. stack is a shorthand hint for viewing the RPN stack. Tab-completes.
Here's what a session looks like:
@@ -501,6 +597,8 @@ http://www.gnu.org/software/src-highlite -->
Or from the source directory: mage install.
+One quirk: there are no -h or --help flags. gt version gives you the version, and bare gt with no TTY prints usage. If you pass -h, gt tries to evaluate it as RPN and errors. It's intentional and keeps the surface area small.
+
Wrapping up
The local LLM experiment worked. The code is clean enough, the tests pass, the docs are thorough, and I use the tool. The logo was generated by a local model too.
diff --git a/index.html b/index.html
index 0cd767c7..d8790a4c 100644
--- a/index.html
+++ b/index.html
@@ -13,7 +13,7 @@