💠 mm

Simple CLI math expression evaluator.

Order agnostic expression evaluator (order of operations determined only by order of operators and not operands itself) meaning that ++ 1 and 1 ++ essentially the same expression. It also supports constants like Pi and other.

mm uses repl to interact with user with live results and error highlighting.

🧩 Get Started

Install using go install:

go install github.com/mymmrac/[email protected]

Note: Make sure to add $GOPATH/bin into $PATH

Start repl and type some expressions:

mm

> 1 + 1

> 2 ^ 8 / 3.1

> 1 / (2.5 !ceil) -

⌨️ Shortcuts

  • Enter – evaluate expression
  • Up, Tab – previews executed expression
  • Down, Shift+Tab – next executed expression
  • Shift+Tab – use result of last expression as input (only if input empty)
  • Esc – exit if input is empty, or clean input
  • Crtl+c – force quit

⚡ Operators

Binary

  • + Addition
  • - Subtraction
  • * Multiplication
  • / Division
  • ^ Power (only integer powers)
  • @ Nth Root (only integer roots)
  • % Mod (only integers)

Unary

  • - Minus
  • ++ Increment
  • -- Decrement
  • !abs Abs
  • !round Round
  • !floor Floor
  • !ceil Ceil

📖 Constants

  • Pi – 3.1415926…
  • e – 2.7182818…

🔐 License

mm is distributed under MIT licence.

GitHub

View Github