From 5f6875c97bebd0c2f677f38e4e06367b0414e182 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 23 May 2026 20:31:39 +0300 Subject: =?UTF-8?q?docs:=20fix=20README=20discrepancies=20=E2=80=94=20remo?= =?UTF-8?q?ve=20'delete=20x',=20add=20comparison=20operators?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove 'delete x' command documentation (not implemented; only 'clear' clears all variables). Add Comparison Operators section documenting gt/lt/gte/lte/eq/neq and shorthand symbols (>/=/<=/==/!=) with examples. These operators were used in Boolean-to-Number Coercion examples but never documented. --- README.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c91518b..44bbea4 100644 --- a/README.md +++ b/README.md @@ -213,17 +213,6 @@ gt 'pi' # Now returns the constant π # → 3.141592654 ``` -```bash -gt 'vars' # List all variables -# x = 5 - -gt 'delete x' # Delete a specific variable -# Variable removed - -gt 'clear' # Clear all variables (also restores overridden built-in constants) -# All variables cleared -``` - See the Constant Management section for the `constants` command to list all available constants. ### Working with Variables @@ -284,6 +273,54 @@ To show the current stack without modifying it: 45 ``` +## Comparison Operators + +Comparison operators push a boolean result (`true`/`false`) onto the stack: + +```bash +gt '5 3 gt' # 5 > 3 +# → true + +gt '3 5 lt' # 3 < 5 +# → true + +gt '5 5 gte' # 5 >= 5 +# → true + +gt '5 5 lte' # 5 <= 5 +# → true + +gt '5 5 eq' # 5 == 5 +# → true + +gt '5 3 neq' # 5 != 3 +# → true +``` + +Shorthand symbols are also supported: + +```bash +gt '5 3 >' # Same as gt +# → true + +gt '3 5 <' # Same as lt +# → true + +gt '5 5 >=' # Same as gte +# → true + +gt '5 5 <=' # Same as lte +# → true + +gt '5 5 ==' # Same as eq +# → true + +gt '5 3 !=' # Same as neq +# → true +``` + +Comparison operators are metric-aware: they work with numbers that have attached units. + ## Boolean-to-Number Coercion Boolean values are automatically coerced to numbers when used in arithmetic operations: -- cgit v1.2.3