____  _   _ ____   ___ 
|  _ \| | | |    \ /___)
| | | | |_| | | | |___ |
|_| |_|____/|_|_|_(___/ 

nums : a stack based calculator

nums is a cli calculator that uses postfix notation and can accept piped data.

Getting nums

nums requires a go compiler. It uses the standard library only and should run fine on any system with said interpreter installed.

git clone https://tildegit.org/sloum/nums && cd nums
go install

If after running the above your system cannot find the nums executable you may need to add your go installs folder to your $PATH. You can alternately build locally with go build.


nums is a fairly simple program. Like a few of my other programs (nimf, tally, gnums), nums uses postfix, or reverse polish, notation.

Once you are comfortable with the concept, nums should be very straightforward. When invoked/run nothing is printed to the screen and you may type in your calculations. Numbers and operators can be separated by any number of whitespace characters and will be calculated from left to right upon the enter key being pressed. The output will be the current stack state. You can then type in more calculations that affect the stack. There are a number of available functions/operators available, including the ability to clear the stack and start over.

To exit nums simply press enter with no other text on the input line.




The following commands all have a three character version and a single character version. Either one is valid. The operators are case insensitive.

The following commands operate on the stack, rather than as numerical operations:

Piped Data

To use data from a command line pipe use the -p flag, for example:

echo "2 2 +" | nums -p

The above example would output 4, but without the -p flag would produce a runtime panic.