narrowtux / abacus

Parses and evaluates mathematical expressions in Elixir. Inspired by math.js
MIT License
85 stars 18 forks source link

Support strings coercion in scope #10

Closed am-kantox closed 8 years ago

am-kantox commented 8 years ago
iex(1)> Abacus.eval "a>5", %{"a" => 4.5}
{:ok, false}
iex(2)> Abacus.eval "a>5", %{"a" => "4.5"}
{:ok, true}

Of course, I can do a coercion to respective Float before evaling, but people expect this to be done by abacus :)

I believe, the coercion might be easily done here. Please confirm, and I will provide the pull request. Thanks in advance.

narrowtux commented 8 years ago

I'm not sure if that would be in scope of the library, it feels like fuzzy behaviour to me.

Also, this can bite me if I decide to implement some string support later.

am-kantox commented 8 years ago

Fair enough. Please don’t hesitate to close this issue, you’re absolutely right, this is out of scope.

Sorry for bringing this out.

narrowtux commented 8 years ago

Don't feel bad about it :)