naive_mather v0.1.0

Crystal Shard that calculates result of a text-base equation.

naive_mather

Calculates the result of a basic math equation stored in a String.

NaiveMather.calculate("3 + 4 * (3 + 4)")
 => 31

Only handles +, -, *, /, and parentheses.

Docs GitHub release

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  naive_mather:
    github: blazerw/naive_mather
  1. Run shards install

Usage

require "naive_mather"

Just pass your equation String to NaiveMather.calculate()

Development

Follow Crystal's guidelines: https://crystal-lang.org/reference/guides/writing_shards.html and realize that Spec2 is used for testing, specifically this fork

Contributing

  1. Fork it (https://github.com/blazerw/naive_mather/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

naive_mather

Owner
Statistic
  • 3
  • 0
  • 0
  • 1
  • 1
  • over 5 years ago
  • April 12, 2019
License

MIT License

Links
Synced at

Wed, 06 Nov 2024 15:54:06 GMT

Languages