guac
is a minimal but powerful interactive stack-based calculator which displays on just a few lines of the terminal.
demo (asciinema):
- modal reverse polish notation, pretty much the most keystroke-efficient calculator interface you can get
- variables & constants that understand algebra (e.g.,
5·π
times2·π^2
is automatically10·π^3
) - seamless input & display in all radices (bases) from 2 to 64 (see the wiki)
- horizontal stack that doesn't display on an alternate terminal screen
guac
should work on all of these terminals, and almost certainly more (basically any modern terminal regardless of OS).
download a pre-built executable of the latest release.
if you have the rust toolchain installed, simply:
$ git clone https://github.com/jacobhenn/guac.git
$ cd guac
$ cargo install --path .
if you won't be developing guac
, run cargo clean
after installing to save disc space.
see this list in the terminal by running guac keys
.
here, "selected expression" refers to either the manually selected expression, or the topmost expression in the stack (not the input) if none is selected
q
orescape
: quit- digit,
.
, ore
: type a number in the input (e
for e-notation) #
enter radix mode (see the wiki)backspace
- if the input is selected and not empty, drop the last char
- if the input is selected but empty, drop the top of the stack
- else, drop the expression to the left of the selection
enter
orspace
: push the input to the stack+
: add-
: subtract*
: multiply/
: divide`
: reciprocal~
: opposite (by analogy to Vim's~
)\
: absolute value (by proximity to|
)d
: drop the selected expression^
: exponentiateg
: natural logG
: log with given baser
: square rootR
: square%
: modulo;
: toggle the selected expression's display mode between exact and approximate[
: toggle displaying the selected expression in debug views
: sinec
: cosinet
: tangentx
: push xh
: select to the left (by analogy to Vim'sh
)l
: select to the right (by analogy to Vim'sl
)>
: move selected expression to the right (by analogy to Vim's>>
)<
: move selected expression to the left (by analogy to Vim's<<
)right
: swap the selected expression with the expression to its lefta
: cancel selection and jump to input (by analogy to Vim'sA
)ctrl-u
: delete all stack elements to the left of the selection (by convention):
: enter command mode (by analogy to Vim's:
) (see the wiki)|
: enter pipe mode- any char: type a command (to be executed directly, not through your
$SHELL
) enter
: pipe the selected expression to the entered commandescape
: cancel
- any char: type a command (to be executed directly, not through your
v
: enter variable mode- any char: type in a custom variable name
escape
: cancel
k
: enter constant modep
: pie
: eg
: euler-mascheroni gamma constantc
: speed of light (m·s⁻¹)G
: gravitational constant (m³·kg⁻¹·s⁻²)h
: planck constant (J·Hz⁻¹)H
: reduced planck constant (J·s)k
: boltzmann constant (J·K⁻¹)E
: elementary charge (C)m
: mass ofe
: electron (kg)p
: proton (kg)
escape
: cancel
guac
doesn't do too well with very narrow (<15 column) terminals, or with quickly resizing terminals, although it shouldn't totally break.guac
does not directly set any limit on number size or precision; this is by design. it will absolutely try to perform any operation you tell it to, and will only panic on account of insufficient resources if thenum
crate or any system call it performs does. if it hangs too long on an operation, just runpkill guac
from another terminal or close the window.- the algorithms
guac
uses to perform algebra are all hand-written, and their correctness should not be assumed at this stage of development. if you encounter an inconsistency, please submit an issue. - undo/redo is a little janky