naive_mather v0.1.0
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.
Installation
- Add the dependency to your
shard.yml
:
dependencies:
naive_mather:
github: blazerw/naive_mather
- 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
- Fork it (https://github.com/blazerw/naive_mather/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Randy Wilson - creator and maintainer
- Lukasz Wrobel - Ruby version, the "real" creator
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