Skip to content

saulecabrera/leibniz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leibniz

Build Status codecov

Leibniz is a pure erlang/elixir math expression parser and evaluator.

Installation

defp deps() do
  [{:leibniz, "~> 1.0.0"}]
end

Usage

Documentation

Leibniz provides two core functionalities, evaluating valid math expressions and evaluating valid math expression in a given context.

Examples

Evaluating simple math expressions

Leibniz.eval("1 + 1")

{:ok, 2}

Evaluating math expressions in a given context

Leibniz.eval("10 * foo", foo: 10)

{:ok, 100}
Leibniz.eval("1 * baz")
{:error, "value expected for the following dependencies: baz"}

TODO

  • Improve errors
  • Provide a parse/1 function
  • Provide a depencies/1 function
  • Add trigonometric and other math functions

LICENSE

MIT

About

Math expression parser and evaluator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published