an infix calculator implemented in clojure
Switch branches/tags
Nothing to show
Clone or download
Latest commit 203c8cb Sep 18, 2016
Permalink
Failed to load latest commit information.
doc Initial Commit Sep 16, 2016
src/test Rewrote some functions to use multiple arity Sep 18, 2016
test/test Initial Commit Sep 16, 2016
.gitignore Initial Commit Sep 16, 2016
CHANGELOG.md Initial Commit Sep 16, 2016
LICENSE Initial Commit Sep 16, 2016
README.md rpn, not prn. Silly me Sep 16, 2016
project.clj Initial Commit Sep 16, 2016

README.md

test.rpn

-- name should probably be changed

A Clojure "library" for solving infix expressions.

Usage

There are a number of functions to do each part of the parsing and calculation.
The test.rpn/regexes map contains regexes for each of the different tokens recognized by the lexical parser.
The test.rpn/shunt function implements a shunting yard algorithm modified to work recursively instead of iteratively.
The test.rpn/evalExpr function evaluates a postfix expression using the regexes and functions provided in the test.rpn/regexes and test.rpn/funcs maps.

The function test.rpn/solve takes in an infix expression string and evaluates it and returns the result.

License

Copyright © 2016 FIXME

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.